@things-factory/integration-base 6.2.86 → 6.2.88
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/dist-server/engine/connector/echo-back-connector.js +1 -1
- package/dist-server/engine/connector/echo-back-connector.js.map +1 -1
- package/dist-server/engine/connector/echo-back-server.js +1 -1
- package/dist-server/engine/connector/echo-back-server.js.map +1 -1
- package/dist-server/engine/connector/graphql-connector.js.map +1 -1
- package/dist-server/engine/connector/http-connector.js.map +1 -1
- package/dist-server/engine/connector/mqtt-connector.js.map +1 -1
- package/dist-server/engine/connector/mssql-connector.js.map +1 -1
- package/dist-server/engine/connector/mysql-connector.js +3 -3
- package/dist-server/engine/connector/mysql-connector.js.map +1 -1
- package/dist-server/engine/connector/operato-connector.js.map +1 -1
- package/dist-server/engine/connector/oracle-connector.js.map +1 -1
- package/dist-server/engine/connector/postgresql-connector.js.map +1 -1
- package/dist-server/engine/connector/socket-server.js +1 -1
- package/dist-server/engine/connector/socket-server.js.map +1 -1
- package/dist-server/engine/connector/sqlite-connector.js.map +1 -1
- package/dist-server/engine/task/book-up-scenario.js.map +1 -1
- package/dist-server/engine/task/csv-readline.js.map +1 -1
- package/dist-server/engine/task/data-accessor.js.map +1 -1
- package/dist-server/engine/task/data-mapper.js.map +1 -1
- package/dist-server/engine/task/database-query.js.map +1 -1
- package/dist-server/engine/task/echo-receive.js.map +1 -1
- package/dist-server/engine/task/echo-send.js.map +1 -1
- package/dist-server/engine/task/empty-check.js.map +1 -1
- package/dist-server/engine/task/end.js.map +1 -1
- package/dist-server/engine/task/floating-point.js.map +1 -1
- package/dist-server/engine/task/goto.js.map +1 -1
- package/dist-server/engine/task/graphql-mutate.js.map +1 -1
- package/dist-server/engine/task/graphql-query.js.map +1 -1
- package/dist-server/engine/task/headless-post.js.map +1 -1
- package/dist-server/engine/task/headless-scrap.js.map +1 -1
- package/dist-server/engine/task/http-get.js.map +1 -1
- package/dist-server/engine/task/http-post.js.map +1 -1
- package/dist-server/engine/task/jsonata.js +1 -1
- package/dist-server/engine/task/jsonata.js.map +1 -1
- package/dist-server/engine/task/local-graphql-mutate.js.map +1 -1
- package/dist-server/engine/task/local-graphql-query.js.map +1 -1
- package/dist-server/engine/task/log.js.map +1 -1
- package/dist-server/engine/task/mqtt-publish.js.map +1 -1
- package/dist-server/engine/task/mqtt-subscribe.js.map +1 -1
- package/dist-server/engine/task/oracle-procedure.js.map +1 -1
- package/dist-server/engine/task/pick-pending-scenario.js.map +1 -1
- package/dist-server/engine/task/publish.js.map +1 -1
- package/dist-server/engine/task/random.js.map +1 -1
- package/dist-server/engine/task/reset-pending-queue.js.map +1 -1
- package/dist-server/engine/task/script.js.map +1 -1
- package/dist-server/engine/task/set-domain.js.map +1 -1
- package/dist-server/engine/task/sleep.js.map +1 -1
- package/dist-server/engine/task/socket-listener.js.map +1 -1
- package/dist-server/engine/task/state-read.js.map +1 -1
- package/dist-server/engine/task/state-write.js.map +1 -1
- package/dist-server/engine/task/stop-scenario.js.map +1 -1
- package/dist-server/engine/task/sub-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-goto.js.map +1 -1
- package/dist-server/engine/task/switch-range-goto.js.map +1 -1
- package/dist-server/engine/task/switch-range-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-range-set.js.map +1 -1
- package/dist-server/engine/task/switch-scenario.js.map +1 -1
- package/dist-server/engine/task/switch-set.js.map +1 -1
- package/dist-server/engine/task/throw.js.map +1 -1
- package/dist-server/engine/task/variables.js.map +1 -1
- package/dist-server/engine/types.js.map +1 -1
- package/dist-server/service/connection/connection-type.js +34 -5
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/step/step-type.js +41 -28
- package/dist-server/service/step/step-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/server/engine/connector/echo-back-connector.ts +4 -3
- package/server/engine/connector/echo-back-server.ts +5 -4
- package/server/engine/connector/graphql-connector.ts +4 -3
- package/server/engine/connector/http-connector.ts +4 -3
- package/server/engine/connector/mqtt-connector.ts +4 -3
- package/server/engine/connector/mssql-connector.ts +4 -3
- package/server/engine/connector/mysql-connector.ts +8 -6
- package/server/engine/connector/operato-connector.ts +5 -3
- package/server/engine/connector/oracle-connector.ts +6 -3
- package/server/engine/connector/postgresql-connector.ts +4 -3
- package/server/engine/connector/socket-server.ts +5 -4
- package/server/engine/connector/sqlite-connector.ts +5 -3
- package/server/engine/task/book-up-scenario.ts +3 -1
- package/server/engine/task/csv-readline.ts +4 -1
- package/server/engine/task/data-accessor.ts +4 -1
- package/server/engine/task/data-mapper.ts +4 -1
- package/server/engine/task/database-query.ts +3 -1
- package/server/engine/task/echo-receive.ts +4 -1
- package/server/engine/task/echo-send.ts +3 -1
- package/server/engine/task/empty-check.ts +4 -1
- package/server/engine/task/end.ts +4 -1
- package/server/engine/task/floating-point.ts +4 -1
- package/server/engine/task/goto.ts +4 -1
- package/server/engine/task/graphql-mutate.ts +3 -1
- package/server/engine/task/graphql-query.ts +3 -1
- package/server/engine/task/headless-post.ts +4 -1
- package/server/engine/task/headless-scrap.ts +3 -1
- package/server/engine/task/http-get.ts +3 -1
- package/server/engine/task/http-post.ts +3 -1
- package/server/engine/task/jsonata.ts +5 -2
- package/server/engine/task/local-graphql-mutate.ts +5 -1
- package/server/engine/task/local-graphql-query.ts +3 -1
- package/server/engine/task/log.ts +3 -1
- package/server/engine/task/mqtt-publish.ts +3 -1
- package/server/engine/task/mqtt-subscribe.ts +3 -1
- package/server/engine/task/oracle-procedure.ts +3 -1
- package/server/engine/task/pick-pending-scenario.ts +3 -1
- package/server/engine/task/publish.ts +3 -1
- package/server/engine/task/random.ts +4 -1
- package/server/engine/task/reset-pending-queue.ts +3 -1
- package/server/engine/task/script.ts +4 -1
- package/server/engine/task/set-domain.ts +4 -1
- package/server/engine/task/sleep.ts +3 -1
- package/server/engine/task/socket-listener.ts +3 -1
- package/server/engine/task/state-read.ts +3 -1
- package/server/engine/task/state-write.ts +3 -1
- package/server/engine/task/stop-scenario.ts +3 -1
- package/server/engine/task/sub-scenario.ts +3 -1
- package/server/engine/task/switch-goto.ts +4 -1
- package/server/engine/task/switch-range-goto.ts +3 -1
- package/server/engine/task/switch-range-scenario.ts +3 -1
- package/server/engine/task/switch-range-set.ts +3 -1
- package/server/engine/task/switch-scenario.ts +3 -1
- package/server/engine/task/switch-set.ts +3 -1
- package/server/engine/task/throw.ts +3 -1
- package/server/engine/task/variables.ts +3 -1
- package/server/engine/types.ts +81 -4
- package/server/service/connection/connection-type.ts +67 -0
- package/server/service/step/step-type.ts +78 -22
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-base",
|
3
|
-
"version": "6.2.
|
3
|
+
"version": "6.2.88",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -26,12 +26,13 @@
|
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
28
|
"@apollo/client": "^3.6.9",
|
29
|
-
"@things-factory/api": "^6.2.
|
30
|
-
"@things-factory/auth-base": "^6.2.
|
29
|
+
"@things-factory/api": "^6.2.88",
|
30
|
+
"@things-factory/auth-base": "^6.2.88",
|
31
31
|
"@things-factory/env": "^6.2.33",
|
32
|
-
"@things-factory/oauth2-client": "^6.2.
|
33
|
-
"@things-factory/scheduler-client": "^6.2.
|
34
|
-
"@things-factory/shell": "^6.2.
|
32
|
+
"@things-factory/oauth2-client": "^6.2.88",
|
33
|
+
"@things-factory/scheduler-client": "^6.2.88",
|
34
|
+
"@things-factory/shell": "^6.2.88",
|
35
|
+
"@things-factory/utils": "^6.2.48",
|
35
36
|
"async-mqtt": "^2.5.0",
|
36
37
|
"chance": "^1.1.11",
|
37
38
|
"cross-fetch": "^3.0.4",
|
@@ -46,5 +47,5 @@
|
|
46
47
|
"devDependencies": {
|
47
48
|
"@types/cron": "^2.0.1"
|
48
49
|
},
|
49
|
-
"gitHead": "
|
50
|
+
"gitHead": "700ee6ac193bb6b6bc4f1a569c3ca046a7a049ee"
|
50
51
|
}
|
@@ -3,6 +3,7 @@ import PromiseSocket from 'promise-socket'
|
|
3
3
|
|
4
4
|
import { Connector } from '../types'
|
5
5
|
import { ConnectionManager } from '../connection-manager'
|
6
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
6
7
|
|
7
8
|
export class EchoBack implements Connector {
|
8
9
|
async ready(connectionConfigs) {
|
@@ -11,12 +12,12 @@ export class EchoBack implements Connector {
|
|
11
12
|
ConnectionManager.logger.info('echo-back connections are ready')
|
12
13
|
}
|
13
14
|
|
14
|
-
async connect(connection) {
|
15
|
+
async connect(connection: InputConnection) {
|
15
16
|
let socket = new PromiseSocket(new net.Socket())
|
16
17
|
let [host, port = 8124] = connection.endpoint.split(':')
|
17
18
|
|
18
19
|
try {
|
19
|
-
await socket.connect(port, host)
|
20
|
+
await socket.connect(Number(port), host)
|
20
21
|
ConnectionManager.addConnectionInstance(connection, socket)
|
21
22
|
|
22
23
|
ConnectionManager.logger.info(
|
@@ -29,7 +30,7 @@ export class EchoBack implements Connector {
|
|
29
30
|
}
|
30
31
|
}
|
31
32
|
|
32
|
-
async disconnect(connection) {
|
33
|
+
async disconnect(connection: InputConnection) {
|
33
34
|
let socket = ConnectionManager.removeConnectionInstance(connection)
|
34
35
|
|
35
36
|
await socket.destroy()
|
@@ -3,15 +3,16 @@ import PromiseSocket from 'promise-socket'
|
|
3
3
|
|
4
4
|
import { Connector } from '../types'
|
5
5
|
import { ConnectionManager } from '../connection-manager'
|
6
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
6
7
|
|
7
8
|
export class EchoBack implements Connector {
|
8
|
-
async ready(connectionConfigs) {
|
9
|
+
async ready(connectionConfigs: InputConnection[]) {
|
9
10
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
10
11
|
|
11
12
|
ConnectionManager.logger.info('echo-back-servers are ready')
|
12
13
|
}
|
13
14
|
|
14
|
-
async connect(config): Promise<void> {
|
15
|
+
async connect(config: InputConnection): Promise<void> {
|
15
16
|
var [host = '0.0.0.0', port = 8124] = config.endpoint.split(':')
|
16
17
|
|
17
18
|
return new Promise((resolve, reject) => {
|
@@ -35,7 +36,7 @@ export class EchoBack implements Connector {
|
|
35
36
|
|
36
37
|
try {
|
37
38
|
let promiseSocket = new PromiseSocket(socket)
|
38
|
-
await promiseSocket.connect(port, 'localhost')
|
39
|
+
await promiseSocket.connect(Number(port), 'localhost')
|
39
40
|
promiseSocket['__server__'] = server
|
40
41
|
|
41
42
|
ConnectionManager.addConnectionInstance(config, promiseSocket)
|
@@ -53,7 +54,7 @@ export class EchoBack implements Connector {
|
|
53
54
|
})
|
54
55
|
}
|
55
56
|
|
56
|
-
async disconnect(connection) {
|
57
|
+
async disconnect(connection: InputConnection) {
|
57
58
|
let socket = ConnectionManager.removeConnectionInstance(connection)
|
58
59
|
var server = socket['__server__']
|
59
60
|
|
@@ -7,6 +7,7 @@ import { getRepository } from '@things-factory/shell'
|
|
7
7
|
|
8
8
|
import { ConnectionManager } from '../connection-manager'
|
9
9
|
import { Connector } from '../types'
|
10
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
10
11
|
|
11
12
|
const defaultOptions: any = {
|
12
13
|
watchQuery: {
|
@@ -27,13 +28,13 @@ const cache = new InMemoryCache({
|
|
27
28
|
})
|
28
29
|
|
29
30
|
export class GraphqlConnector implements Connector {
|
30
|
-
async ready(connectionConfigs) {
|
31
|
+
async ready(connectionConfigs: InputConnection[]) {
|
31
32
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
32
33
|
|
33
34
|
ConnectionManager.logger.info('graphql-connector connections are ready')
|
34
35
|
}
|
35
36
|
|
36
|
-
async connect(connection) {
|
37
|
+
async connect(connection: InputConnection) {
|
37
38
|
var {
|
38
39
|
endpoint: uri,
|
39
40
|
params: { authClient }
|
@@ -85,7 +86,7 @@ export class GraphqlConnector implements Connector {
|
|
85
86
|
)
|
86
87
|
}
|
87
88
|
|
88
|
-
async disconnect(connection) {
|
89
|
+
async disconnect(connection: InputConnection) {
|
89
90
|
var client = ConnectionManager.getConnectionInstance(connection)
|
90
91
|
client.stop()
|
91
92
|
ConnectionManager.removeConnectionInstance(connection)
|
@@ -3,15 +3,16 @@ import { getRepository } from '@things-factory/shell'
|
|
3
3
|
|
4
4
|
import { ConnectionManager } from '../connection-manager'
|
5
5
|
import { Connector } from '../types'
|
6
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
6
7
|
|
7
8
|
export class HttpConnector implements Connector {
|
8
|
-
async ready(connectionConfigs) {
|
9
|
+
async ready(connectionConfigs: InputConnection[]) {
|
9
10
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
10
11
|
|
11
12
|
ConnectionManager.logger.info('http-connector connections are ready')
|
12
13
|
}
|
13
14
|
|
14
|
-
async connect(connection) {
|
15
|
+
async connect(connection: InputConnection) {
|
15
16
|
var { params } = connection
|
16
17
|
params.rejectUnauthorized = (params.rejectUnauthorized || 'Y') === 'Y'
|
17
18
|
|
@@ -29,7 +30,7 @@ export class HttpConnector implements Connector {
|
|
29
30
|
ConnectionManager.logger.info(`http-connector connection(${connection.name}:${connection.endpoint}) is connected`)
|
30
31
|
}
|
31
32
|
|
32
|
-
async disconnect(connection) {
|
33
|
+
async disconnect(connection: InputConnection) {
|
33
34
|
ConnectionManager.removeConnectionInstance(connection)
|
34
35
|
|
35
36
|
ConnectionManager.logger.info(`http-connector connection(${connection.name}) is disconnected`)
|
@@ -1,16 +1,17 @@
|
|
1
1
|
import { Connector } from '../types'
|
2
2
|
import { ConnectionManager } from '../connection-manager'
|
3
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
3
4
|
|
4
5
|
import mqtt from 'async-mqtt'
|
5
6
|
|
6
7
|
export class MqttConnector implements Connector {
|
7
|
-
async ready(connectionConfigs) {
|
8
|
+
async ready(connectionConfigs: InputConnection[]) {
|
8
9
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
9
10
|
|
10
11
|
ConnectionManager.logger.info('mqtt-connector connections are ready')
|
11
12
|
}
|
12
13
|
|
13
|
-
async connect(connection) {
|
14
|
+
async connect(connection: InputConnection) {
|
14
15
|
const {
|
15
16
|
endpoint: uri,
|
16
17
|
params: { user, password }
|
@@ -43,7 +44,7 @@ export class MqttConnector implements Connector {
|
|
43
44
|
}
|
44
45
|
}
|
45
46
|
|
46
|
-
async disconnect(connection) {
|
47
|
+
async disconnect(connection: InputConnection) {
|
47
48
|
const { client } = ConnectionManager.removeConnectionInstance(connection)
|
48
49
|
|
49
50
|
client && (await client.end())
|
@@ -2,6 +2,7 @@ import { logger } from '@things-factory/env'
|
|
2
2
|
|
3
3
|
import { ConnectionManager } from '../connection-manager'
|
4
4
|
import { Connector } from '../types'
|
5
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
5
6
|
|
6
7
|
try {
|
7
8
|
var Client = require('mssql')
|
@@ -10,13 +11,13 @@ try {
|
|
10
11
|
}
|
11
12
|
|
12
13
|
export class MssqlConnector implements Connector {
|
13
|
-
async ready(connectionConfigs) {
|
14
|
+
async ready(connectionConfigs: InputConnection[]) {
|
14
15
|
await Promise.all(connectionConfigs.map(this.connect))
|
15
16
|
|
16
17
|
ConnectionManager.logger.info('mssql-connector connections are ready')
|
17
18
|
}
|
18
19
|
|
19
|
-
async connect(connection) {
|
20
|
+
async connect(connection: InputConnection) {
|
20
21
|
const {
|
21
22
|
endpoint,
|
22
23
|
params: { user, password, database, encrypt = 'Y' }
|
@@ -50,7 +51,7 @@ export class MssqlConnector implements Connector {
|
|
50
51
|
ConnectionManager.logger.info(`MSSql Database(${connection.name}:${database}) at ${endpoint} connected.`)
|
51
52
|
}
|
52
53
|
|
53
|
-
async disconnect(connection) {
|
54
|
+
async disconnect(connection: InputConnection) {
|
54
55
|
var client = ConnectionManager.getConnectionInstance(connection)
|
55
56
|
try {
|
56
57
|
await client.close()
|
@@ -1,20 +1,22 @@
|
|
1
|
+
import Mysql from "mysql2/promise";
|
2
|
+
|
1
3
|
import { Connector } from '../types'
|
2
4
|
import { ConnectionManager } from '../connection-manager'
|
3
|
-
import
|
5
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
4
6
|
|
5
7
|
export class mysqlConnector implements Connector {
|
6
|
-
async ready(connectionConfigs) {
|
8
|
+
async ready(connectionConfigs: InputConnection[]) {
|
7
9
|
await Promise.all(connectionConfigs.map(this.connect));
|
8
10
|
ConnectionManager.logger.info("mysql-connector connections are ready");
|
9
11
|
}
|
10
12
|
|
11
|
-
async connect(connection) {
|
13
|
+
async connect(connection: InputConnection) {
|
12
14
|
const {
|
13
15
|
endpoint,
|
14
16
|
params: { user, password, database },
|
15
17
|
} = connection;
|
16
18
|
|
17
|
-
|
19
|
+
let [host, port = '3306'] = endpoint.split(":");
|
18
20
|
|
19
21
|
if (!Mysql) {
|
20
22
|
throw new Error("mysql module loading failed");
|
@@ -24,7 +26,7 @@ export class mysqlConnector implements Connector {
|
|
24
26
|
user,
|
25
27
|
password,
|
26
28
|
host,
|
27
|
-
port,
|
29
|
+
port: Number(port),
|
28
30
|
database,
|
29
31
|
});
|
30
32
|
|
@@ -50,7 +52,7 @@ export class mysqlConnector implements Connector {
|
|
50
52
|
);
|
51
53
|
}
|
52
54
|
|
53
|
-
async disconnect(connection) {
|
55
|
+
async disconnect(connection: InputConnection) {
|
54
56
|
var client = ConnectionManager.getConnectionInstance(connection);
|
55
57
|
try {
|
56
58
|
await client.close();
|
@@ -12,6 +12,8 @@ import gql from 'graphql-tag'
|
|
12
12
|
|
13
13
|
import { ConnectionManager } from '../connection-manager'
|
14
14
|
import { Connector } from '../types'
|
15
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
16
|
+
|
15
17
|
import { Scenario } from '../../service/scenario/scenario'
|
16
18
|
import { ScenarioInstance } from '../../service/scenario-instance/scenario-instance-type'
|
17
19
|
|
@@ -51,13 +53,13 @@ interface SubscriberData {
|
|
51
53
|
export class OperatoConnector implements Connector {
|
52
54
|
private context: any
|
53
55
|
|
54
|
-
async ready(connectionConfigs) {
|
56
|
+
async ready(connectionConfigs: InputConnection[]) {
|
55
57
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
56
58
|
|
57
59
|
ConnectionManager.logger.info('graphql-connector connections are ready')
|
58
60
|
}
|
59
61
|
|
60
|
-
async connect(connection) {
|
62
|
+
async connect(connection: InputConnection) {
|
61
63
|
var {
|
62
64
|
endpoint: uri,
|
63
65
|
params: { authKey, domain, subscriptionHandlers = {} }
|
@@ -187,7 +189,7 @@ export class OperatoConnector implements Connector {
|
|
187
189
|
)
|
188
190
|
}
|
189
191
|
|
190
|
-
async disconnect(connection) {
|
192
|
+
async disconnect(connection: InputConnection) {
|
191
193
|
var client = ConnectionManager.getConnectionInstance(connection)
|
192
194
|
let subscriptions: SubscriberData[] = client['subscriptions']
|
193
195
|
subscriptions.forEach(subscription => subscription.subscriptionObserver.unsubscribe())
|
@@ -2,6 +2,8 @@ import { logger } from '@things-factory/env'
|
|
2
2
|
|
3
3
|
import { ConnectionManager } from '../connection-manager'
|
4
4
|
import { Connector } from '../types'
|
5
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
6
|
+
|
5
7
|
|
6
8
|
try {
|
7
9
|
var Client = require('oracledb')
|
@@ -10,13 +12,13 @@ try {
|
|
10
12
|
}
|
11
13
|
|
12
14
|
export class OracleConnector implements Connector {
|
13
|
-
async ready(connectionConfigs) {
|
15
|
+
async ready(connectionConfigs: InputConnection[]) {
|
14
16
|
await Promise.all(connectionConfigs.map(this.connect))
|
15
17
|
|
16
18
|
ConnectionManager.logger.info('oracle-connector connections are ready')
|
17
19
|
}
|
18
20
|
|
19
|
-
async connect(connection) {
|
21
|
+
async connect(connection: InputConnection) {
|
20
22
|
const {
|
21
23
|
endpoint,
|
22
24
|
params: { user, password, database }
|
@@ -57,8 +59,9 @@ export class OracleConnector implements Connector {
|
|
57
59
|
ConnectionManager.logger.info(`Oracle Database(${connection.name}:${database}) at ${endpoint} connected.`)
|
58
60
|
}
|
59
61
|
|
60
|
-
async disconnect(connection) {
|
62
|
+
async disconnect(connection: InputConnection) {
|
61
63
|
var client = ConnectionManager.getConnectionInstance(connection)
|
64
|
+
|
62
65
|
try {
|
63
66
|
await client.close()
|
64
67
|
ConnectionManager.logger.info(`Oracle Database(${connection.name}) closed.`)
|
@@ -2,6 +2,7 @@ import { logger } from '@things-factory/env'
|
|
2
2
|
|
3
3
|
import { ConnectionManager } from '../connection-manager'
|
4
4
|
import { Connector } from '../types'
|
5
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
5
6
|
|
6
7
|
try {
|
7
8
|
var { Client } = require('pg')
|
@@ -10,13 +11,13 @@ try {
|
|
10
11
|
}
|
11
12
|
|
12
13
|
export class PostgresqlConnector implements Connector {
|
13
|
-
async ready(connectionConfigs) {
|
14
|
+
async ready(connectionConfigs: InputConnection[]) {
|
14
15
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
15
16
|
|
16
17
|
ConnectionManager.logger.info('postgresql-connector connections are ready')
|
17
18
|
}
|
18
19
|
|
19
|
-
async connect(connection) {
|
20
|
+
async connect(connection: InputConnection) {
|
20
21
|
const {
|
21
22
|
endpoint,
|
22
23
|
params: { user, password, database }
|
@@ -59,7 +60,7 @@ export class PostgresqlConnector implements Connector {
|
|
59
60
|
}
|
60
61
|
}
|
61
62
|
|
62
|
-
async disconnect(connection) {
|
63
|
+
async disconnect(connection: InputConnection) {
|
63
64
|
var client = ConnectionManager.getConnectionInstance(connection)
|
64
65
|
try {
|
65
66
|
await client.close()
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import net from 'net'
|
2
|
+
import { EventEmitter } from 'events'
|
2
3
|
|
3
4
|
import { Connector } from '../types'
|
4
5
|
import { ConnectionManager } from '../connection-manager'
|
5
|
-
import {
|
6
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
6
7
|
|
7
8
|
export class SocketServer implements Connector {
|
8
9
|
// socket: any
|
9
10
|
|
10
|
-
async ready(connectionConfigs) {
|
11
|
+
async ready(connectionConfigs: InputConnection[]) {
|
11
12
|
await Promise.all(connectionConfigs.map(this.connect))
|
12
13
|
ConnectionManager.logger.info('socket servers are ready')
|
13
14
|
}
|
14
15
|
|
15
|
-
async connect(config): Promise<void> {
|
16
|
+
async connect(config: InputConnection): Promise<void> {
|
16
17
|
var em = new EventEmitter()
|
17
18
|
var [host = '0.0.0.0', port = 8124] = config.endpoint.split(':')
|
18
19
|
return new Promise((resolve, reject) => {
|
@@ -62,7 +63,7 @@ export class SocketServer implements Connector {
|
|
62
63
|
})
|
63
64
|
}
|
64
65
|
|
65
|
-
async disconnect(connection) {
|
66
|
+
async disconnect(connection: InputConnection) {
|
66
67
|
let em = ConnectionManager.removeConnectionInstance(connection)
|
67
68
|
var tcp = em['__tcp__']
|
68
69
|
var server = em['__server__']
|
@@ -4,6 +4,8 @@ import { logger } from '@things-factory/env'
|
|
4
4
|
|
5
5
|
import { ConnectionManager } from '../connection-manager'
|
6
6
|
import { Connector } from '../types'
|
7
|
+
import { InputConnection } from '../../service/connection/connection-type'
|
8
|
+
|
7
9
|
|
8
10
|
try {
|
9
11
|
var sqlite3 = require('sqlite3').verbose()
|
@@ -12,13 +14,13 @@ try {
|
|
12
14
|
}
|
13
15
|
|
14
16
|
export class SqliteConnector implements Connector {
|
15
|
-
async ready(connectionConfigs) {
|
17
|
+
async ready(connectionConfigs: InputConnection[]) {
|
16
18
|
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
17
19
|
|
18
20
|
ConnectionManager.logger.info('sqlite-connector connections are ready')
|
19
21
|
}
|
20
22
|
|
21
|
-
async connect(connection) {
|
23
|
+
async connect(connection: InputConnection) {
|
22
24
|
var { endpoint } = connection
|
23
25
|
|
24
26
|
if (!sqlite3) {
|
@@ -42,7 +44,7 @@ export class SqliteConnector implements Connector {
|
|
42
44
|
})
|
43
45
|
}
|
44
46
|
|
45
|
-
async disconnect(connection) {
|
47
|
+
async disconnect(connection: InputConnection) {
|
46
48
|
var database = ConnectionManager.getConnectionInstance(connection)
|
47
49
|
try {
|
48
50
|
await database.close()
|
@@ -2,10 +2,12 @@ import { access, deepClone } from '@things-factory/utils'
|
|
2
2
|
import { TaskRegistry } from '../task-registry'
|
3
3
|
import { substitute } from './utils/substitute'
|
4
4
|
import { ScenarioEngine } from '../scenario-engine'
|
5
|
+
import { InputStep } from '../../service/step/step-type'
|
6
|
+
import { Context } from '../types'
|
5
7
|
|
6
8
|
const debug = require('debug')('things-factory:integration-base:book-up-scenarios')
|
7
9
|
|
8
|
-
async function BookUpScenario(step, { logger, data, domain }) {
|
10
|
+
async function BookUpScenario(step: InputStep, { logger, data, domain }: Context) {
|
9
11
|
var {
|
10
12
|
params: { scenario, delay, priority, variables, tag }
|
11
13
|
} = step
|
@@ -6,6 +6,9 @@ const { Readable } = require('stream')
|
|
6
6
|
|
7
7
|
import { TaskRegistry } from '../task-registry'
|
8
8
|
|
9
|
+
import { InputStep } from '../../service/step/step-type'
|
10
|
+
import { Context } from '../types'
|
11
|
+
|
9
12
|
async function createReadStream(source) {
|
10
13
|
let stream
|
11
14
|
|
@@ -37,7 +40,7 @@ async function createReadStream(source) {
|
|
37
40
|
return stream
|
38
41
|
}
|
39
42
|
|
40
|
-
async function CsvReadline(step, context) {
|
43
|
+
async function CsvReadline(step: InputStep, context: Context) {
|
41
44
|
var {
|
42
45
|
params: { path }
|
43
46
|
} = step
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { access } from '@things-factory/utils'
|
2
2
|
import { TaskRegistry } from '../task-registry'
|
3
3
|
|
4
|
-
|
4
|
+
import { InputStep } from '../../service/step/step-type'
|
5
|
+
import { Context } from '../types'
|
6
|
+
|
7
|
+
async function DataAccessor(step: InputStep, { logger, data }: Context) {
|
5
8
|
var {
|
6
9
|
params: { target, accessor }
|
7
10
|
} = step
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { access } from '@things-factory/utils'
|
2
2
|
import { TaskRegistry } from '../task-registry'
|
3
3
|
|
4
|
+
import { InputStep } from '../../service/step/step-type'
|
5
|
+
import { Context } from '../types'
|
6
|
+
|
4
7
|
function mapping(rule, input) {
|
5
8
|
if (Array.isArray(input)) {
|
6
9
|
return input.map(i => mapping(rule, i))
|
@@ -12,7 +15,7 @@ function mapping(rule, input) {
|
|
12
15
|
}, {} as any)
|
13
16
|
}
|
14
17
|
|
15
|
-
async function DataMapper(step, { logger, data }) {
|
18
|
+
async function DataMapper(step: InputStep, { logger, data }: Context) {
|
16
19
|
var {
|
17
20
|
params: { accessor, mappingRule }
|
18
21
|
} = step
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { VM } from 'vm2'
|
2
2
|
import { ConnectionManager } from '../connection-manager'
|
3
3
|
import { TaskRegistry } from '../task-registry'
|
4
|
+
import { InputStep } from '../../service/step/step-type'
|
5
|
+
import { Context } from '../types'
|
4
6
|
|
5
|
-
async function DatabaseQuery(step, context) {
|
7
|
+
async function DatabaseQuery(step: InputStep, context: Context) {
|
6
8
|
var { domain, user, data, variables, lng } = context
|
7
9
|
var {
|
8
10
|
connection: connectionName,
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { TaskRegistry } from '../task-registry'
|
2
2
|
import { ConnectionManager } from '../connection-manager'
|
3
3
|
|
4
|
-
|
4
|
+
import { InputStep } from '../../service/step/step-type'
|
5
|
+
import { Context } from '../types'
|
6
|
+
|
7
|
+
async function EchoReceive(step: InputStep, { logger, domain }: Context) {
|
5
8
|
var { connection: connectionName } = step
|
6
9
|
|
7
10
|
var connection = ConnectionManager.getConnectionInstanceByName(domain, connectionName)
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import { TaskRegistry } from '../task-registry'
|
2
2
|
import { ConnectionManager } from '../connection-manager'
|
3
|
+
import { InputStep } from '../../service/step/step-type'
|
4
|
+
import { Context } from '../types'
|
3
5
|
|
4
|
-
async function EchoSend(step, { logger, domain }) {
|
6
|
+
async function EchoSend(step: InputStep, { logger, domain }: Context) {
|
5
7
|
var {
|
6
8
|
connection: connectionName,
|
7
9
|
params: { message }
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { TaskRegistry } from '../task-registry'
|
2
2
|
import { access } from '@things-factory/utils'
|
3
3
|
|
4
|
-
|
4
|
+
import { InputStep } from '../../service/step/step-type'
|
5
|
+
import { Context } from '../types'
|
6
|
+
|
7
|
+
async function EmptyCheck(step: InputStep, { logger, data }: Context) {
|
5
8
|
var {
|
6
9
|
params: { accessor, goto }
|
7
10
|
} = step
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import { TaskRegistry } from '../task-registry'
|
2
2
|
import { ScenarioInstanceStatus } from '../../service'
|
3
3
|
|
4
|
-
|
4
|
+
import { InputStep } from '../../service/step/step-type'
|
5
|
+
import { Context } from '../types'
|
6
|
+
|
7
|
+
async function End(step: InputStep, { logger }: Context) {
|
5
8
|
return {
|
6
9
|
state: ScenarioInstanceStatus.STOPPED
|
7
10
|
}
|
@@ -2,7 +2,10 @@ import ieee754 from 'ieee754'
|
|
2
2
|
import { access } from '@things-factory/utils'
|
3
3
|
import { TaskRegistry } from '../task-registry'
|
4
4
|
|
5
|
-
|
5
|
+
import { InputStep } from '../../service/step/step-type'
|
6
|
+
import { Context } from '../types'
|
7
|
+
|
8
|
+
async function FloatingPoint(step: InputStep, { logger, data }: Context) {
|
6
9
|
var {
|
7
10
|
params: { accessor, operation, endian, floatType }
|
8
11
|
} = step
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { TaskRegistry } from '../task-registry'
|
2
2
|
|
3
|
-
|
3
|
+
import { InputStep } from '../../service/step/step-type'
|
4
|
+
import { Context } from '../types'
|
5
|
+
|
6
|
+
async function Goto(step: InputStep, { logger }: Context) {
|
4
7
|
var {
|
5
8
|
params: { goto }
|
6
9
|
} = step
|
@@ -5,8 +5,10 @@ import { access } from '@things-factory/utils'
|
|
5
5
|
|
6
6
|
import { ConnectionManager } from '../connection-manager'
|
7
7
|
import { TaskRegistry } from '../task-registry'
|
8
|
+
import { InputStep } from '../../service/step/step-type'
|
9
|
+
import { Context } from '../types'
|
8
10
|
|
9
|
-
async function GraphqlMutate(step, context) {
|
11
|
+
async function GraphqlMutate(step: InputStep, context: Context) {
|
10
12
|
var { connection: connectionName, params: stepOptions } = step
|
11
13
|
var { mutation, variables: variablesAccessorMap, headers } = stepOptions || {}
|
12
14
|
|
@@ -5,8 +5,10 @@ import { access } from '@things-factory/utils'
|
|
5
5
|
|
6
6
|
import { ConnectionManager } from '../connection-manager'
|
7
7
|
import { TaskRegistry } from '../task-registry'
|
8
|
+
import { InputStep } from '../../service/step/step-type'
|
9
|
+
import { Context } from '../types'
|
8
10
|
|
9
|
-
async function GraphqlQuery(step, context) {
|
11
|
+
async function GraphqlQuery(step: InputStep, context: Context) {
|
10
12
|
var { connection: connectionName, params: stepOptions } = step
|
11
13
|
var { query, variables: variablesAccessorMap, headers } = stepOptions || {}
|
12
14
|
var { domain, user, data, variables, lng } = context
|
@@ -7,7 +7,10 @@ import { ConnectionManager } from '../connection-manager'
|
|
7
7
|
|
8
8
|
import { getHeadlessPool } from './utils/headless-pool-for-scenario'
|
9
9
|
|
10
|
-
|
10
|
+
import { InputStep } from '../../service/step/step-type'
|
11
|
+
import { Context } from '../types'
|
12
|
+
|
13
|
+
async function HeadlessPost(step: InputStep, { logger, data, domain }: Context) {
|
11
14
|
var { connection: connectionName, params: stepOptions } = step
|
12
15
|
var { headers: requestHeaders, contentType, path, accessor } = stepOptions || {}
|
13
16
|
|
@@ -4,8 +4,10 @@ import { TaskRegistry } from '../task-registry'
|
|
4
4
|
import { ConnectionManager } from '../connection-manager'
|
5
5
|
|
6
6
|
import { getHeadlessPool } from './utils/headless-pool-for-scenario'
|
7
|
+
import { InputStep } from '../../service/step/step-type'
|
8
|
+
import { Context } from '../types'
|
7
9
|
|
8
|
-
async function HeadlessScrap(step, { logger, data, domain }) {
|
10
|
+
async function HeadlessScrap(step: InputStep, { logger, data, domain }: Context) {
|
9
11
|
var { connection: connectionName, params: stepOptions } = step
|
10
12
|
var { headers: requestHeaders, path, selectors = [] } = stepOptions || {}
|
11
13
|
|