@things-factory/integration-base 8.0.26 → 8.0.38
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/analyzer/analyze-integration.js +1 -1
- package/dist-server/engine/analyzer/analyze-integration.js.map +1 -1
- package/dist-server/engine/connection-manager.js +1 -8
- package/dist-server/engine/connection-manager.js.map +1 -1
- package/dist-server/service/connection/connection-mutation.d.ts +3 -1
- package/dist-server/service/connection/connection-type.d.ts +14 -3
- package/dist-server/service/connection/connection-type.js +19 -15
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/service/scenario/scenario-query.js +1 -1
- package/dist-server/service/scenario/scenario-query.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-type.js +1 -8
- package/dist-server/service/scenario-instance/scenario-instance-type.js.map +1 -1
- package/dist-server/service/step/step-type.d.ts +11 -3
- package/dist-server/service/step/step-type.js +17 -5
- package/dist-server/service/step/step-type.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/server/engine/analyzer/analyze-integration.ts +1 -1
- package/server/engine/connection-manager.ts +1 -8
- package/server/service/connection/connection-type.ts +28 -17
- package/server/service/scenario/scenario-query.ts +1 -1
- package/server/service/scenario-instance/scenario-instance-type.ts +2 -8
- package/server/service/step/step-type.ts +27 -10
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-base",
|
3
|
-
"version": "8.0.
|
3
|
+
"version": "8.0.38",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -27,14 +27,14 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"@apollo/client": "^3.6.9",
|
29
29
|
"@operato/moment-timezone-es": "^8.0.0",
|
30
|
-
"@things-factory/api": "^8.0.
|
31
|
-
"@things-factory/auth-base": "^8.0.
|
32
|
-
"@things-factory/cache-service": "^8.0.
|
33
|
-
"@things-factory/env": "^8.0.
|
34
|
-
"@things-factory/oauth2-client": "^8.0.
|
35
|
-
"@things-factory/scheduler-client": "^8.0.
|
36
|
-
"@things-factory/shell": "^8.0.
|
37
|
-
"@things-factory/utils": "^8.0.
|
30
|
+
"@things-factory/api": "^8.0.38",
|
31
|
+
"@things-factory/auth-base": "^8.0.38",
|
32
|
+
"@things-factory/cache-service": "^8.0.38",
|
33
|
+
"@things-factory/env": "^8.0.37",
|
34
|
+
"@things-factory/oauth2-client": "^8.0.38",
|
35
|
+
"@things-factory/scheduler-client": "^8.0.38",
|
36
|
+
"@things-factory/shell": "^8.0.38",
|
37
|
+
"@things-factory/utils": "^8.0.37",
|
38
38
|
"async-mqtt": "^2.5.0",
|
39
39
|
"chance": "^1.1.11",
|
40
40
|
"cross-fetch": "^3.0.4",
|
@@ -44,5 +44,5 @@
|
|
44
44
|
"readline": "^1.3.0",
|
45
45
|
"ses": "^1.5.0"
|
46
46
|
},
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "613db8b1fa9fd156294f113518348247ae61a2db"
|
48
48
|
}
|
@@ -76,7 +76,7 @@ export async function analyzeIntegration(domain: Domain) {
|
|
76
76
|
const tags = uniq(
|
77
77
|
scenario.steps
|
78
78
|
.filter(step => !step.connection && step.task == 'publish')
|
79
|
-
.map(step =>
|
79
|
+
.map(step => step.params?.tag)
|
80
80
|
.filter(Boolean)
|
81
81
|
)
|
82
82
|
|
@@ -61,16 +61,9 @@ export class ConnectionManager {
|
|
61
61
|
relations: ['domain', 'edge', 'creator', 'updater']
|
62
62
|
})
|
63
63
|
).map(connection => {
|
64
|
-
var params = {}
|
65
|
-
try {
|
66
|
-
params = JSON.parse(connection.params || '{}')
|
67
|
-
} catch (ex) {
|
68
|
-
ConnectionManager.logger.error(`connection '${connection.name}' params should be JSON format`, ex)
|
69
|
-
}
|
70
|
-
|
71
64
|
return {
|
72
65
|
...connection,
|
73
|
-
params
|
66
|
+
params: connection.params || {}
|
74
67
|
}
|
75
68
|
})
|
76
69
|
|
@@ -11,12 +11,15 @@ import {
|
|
11
11
|
} from 'typeorm'
|
12
12
|
|
13
13
|
import { User, Appliance } from '@things-factory/auth-base'
|
14
|
-
import {
|
15
|
-
import { Domain, ObjectRef } from '@things-factory/shell'
|
14
|
+
import { config } from '@things-factory/env'
|
15
|
+
import { Domain, ObjectRef, ScalarObject } from '@things-factory/shell'
|
16
16
|
|
17
17
|
import { ConnectionManager } from '../../engine'
|
18
18
|
import { ProxyConnector } from '../../engine/connector/proxy-connector'
|
19
19
|
|
20
|
+
const ORMCONFIG = config.get('ormconfig', {})
|
21
|
+
const DATABASE_TYPE = ORMCONFIG.type
|
22
|
+
|
20
23
|
export enum ConnectionStatus {
|
21
24
|
CONNECTED = 'CONNECTED',
|
22
25
|
DISCONNECTED = 'DISCONNECTED'
|
@@ -109,10 +112,25 @@ export class Connection {
|
|
109
112
|
|
110
113
|
/**
|
111
114
|
* Additional parameters for the connection, stored as a JSON string.
|
115
|
+
*
|
116
|
+
* [Caution]
|
117
|
+
* 이 컬럼타입은 postgres 데이터베이스에서는 varchar 타입을 유지한다.
|
118
|
+
* 이는 데이터베이스 타입을 변경하면 기존 데이터가 손실될 수 있기 때문이다.
|
119
|
+
* 'simple-json' 타입으로 변경 전에 postgres 데이타베이스에 이미 varchar 타입으로 사용한 사례가 많기 때문이다.
|
112
120
|
*/
|
113
|
-
@Column({
|
114
|
-
|
115
|
-
|
121
|
+
@Column({
|
122
|
+
type: DATABASE_TYPE == 'postgres' ? 'varchar' : 'simple-json',
|
123
|
+
nullable: true,
|
124
|
+
transformer:
|
125
|
+
DATABASE_TYPE == 'postgres'
|
126
|
+
? {
|
127
|
+
to: (value: any) => JSON.stringify(value),
|
128
|
+
from: (value: string) => JSON.parse(value)
|
129
|
+
}
|
130
|
+
: undefined
|
131
|
+
})
|
132
|
+
@Field(type => ScalarObject, { nullable: true })
|
133
|
+
params: { [key: string]: any }
|
116
134
|
|
117
135
|
/**
|
118
136
|
* The date and time when the connection was created.
|
@@ -163,17 +181,10 @@ export class Connection {
|
|
163
181
|
async connect() {
|
164
182
|
const { type, edge } = this
|
165
183
|
const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(type)
|
166
|
-
var params = {}
|
167
|
-
|
168
|
-
try {
|
169
|
-
params = JSON.parse(this.params || '{}')
|
170
|
-
} catch (ex) {
|
171
|
-
logger.error(`connection '${this.name}' params should be JSON format`, ex)
|
172
|
-
}
|
173
184
|
|
174
185
|
await connector.connect({
|
175
186
|
...this,
|
176
|
-
params
|
187
|
+
params: this.params || {}
|
177
188
|
})
|
178
189
|
}
|
179
190
|
|
@@ -244,8 +255,8 @@ export class NewConnection {
|
|
244
255
|
@Field({ nullable: true })
|
245
256
|
endpoint?: string
|
246
257
|
|
247
|
-
@Field({ nullable: true })
|
248
|
-
params?: string
|
258
|
+
@Field(type => ScalarObject, { nullable: true })
|
259
|
+
params?: { [key: string]: any }
|
249
260
|
}
|
250
261
|
|
251
262
|
@InputType()
|
@@ -271,8 +282,8 @@ export class ConnectionPatch {
|
|
271
282
|
@Field({ nullable: true })
|
272
283
|
active?: boolean
|
273
284
|
|
274
|
-
@Field({ nullable: true })
|
275
|
-
params?: string
|
285
|
+
@Field(type => ScalarObject, { nullable: true })
|
286
|
+
params?: { [key: string]: any }
|
276
287
|
|
277
288
|
@Field({ nullable: true })
|
278
289
|
cuFlag?: string
|
@@ -84,7 +84,7 @@ export class ScenarioQuery {
|
|
84
84
|
where: { domain: { id: domain.id }, scenario: { id: scenario.id }, task: 'publish' }
|
85
85
|
})
|
86
86
|
|
87
|
-
return steps.map(step =>
|
87
|
+
return steps.map(step => step.params?.tag).filter(Boolean)
|
88
88
|
}
|
89
89
|
|
90
90
|
@FieldResolver(type => String, { nullable: true })
|
@@ -519,15 +519,9 @@ export class ScenarioInstance {
|
|
519
519
|
this.context.logger.info(`Step '${step.name}'(${step.id}) started.`)
|
520
520
|
|
521
521
|
step = {
|
522
|
-
...step
|
523
|
-
|
524
|
-
|
525
|
-
try {
|
526
|
-
step.params = JSON.parse(step.params)
|
527
|
-
} catch (ex) {
|
528
|
-
this.context.logger.error(`params(${step.params}) parsing error. params must be a JSON.`, ex)
|
522
|
+
...step,
|
523
|
+
params: step.params || {}
|
529
524
|
}
|
530
|
-
step.params = step.params || {}
|
531
525
|
|
532
526
|
const connection =
|
533
527
|
step.connection && ConnectionManager.getConnectionInstanceEntityByName(this.domain, step.connection)
|
@@ -11,10 +11,14 @@ import {
|
|
11
11
|
} from 'typeorm'
|
12
12
|
|
13
13
|
import { User } from '@things-factory/auth-base'
|
14
|
-
import { Domain } from '@things-factory/shell'
|
14
|
+
import { Domain, ScalarObject } from '@things-factory/shell'
|
15
|
+
import { config } from '@things-factory/env'
|
15
16
|
|
16
17
|
import { Scenario } from '../scenario/scenario'
|
17
18
|
|
19
|
+
const ORMCONFIG = config.get('ormconfig', {})
|
20
|
+
const DATABASE_TYPE = ORMCONFIG.type
|
21
|
+
|
18
22
|
@Entity()
|
19
23
|
@Index('ix_step_0', (step: Step) => [step.scenario, step.sequence], { unique: true })
|
20
24
|
@ObjectType()
|
@@ -103,10 +107,25 @@ export class Step {
|
|
103
107
|
|
104
108
|
/**
|
105
109
|
* The parameters for the step.
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
+
*
|
111
|
+
* [Caution]
|
112
|
+
* 이 컬럼타입은 postgres 데이터베이스에서는 varchar 타입을 유지한다.
|
113
|
+
* 이는 데이터베이스 타입을 변경하면 기존 데이터가 손실될 수 있기 때문이다.
|
114
|
+
* 'simple-json' 타입으로 변경 전에 postgres 데이타베이스에 이미 varchar 타입으로 사용한 사례가 많기 때문이다.
|
115
|
+
*/
|
116
|
+
@Column({
|
117
|
+
type: DATABASE_TYPE == 'postgres' ? 'varchar' : 'simple-json',
|
118
|
+
nullable: true,
|
119
|
+
transformer:
|
120
|
+
DATABASE_TYPE == 'postgres'
|
121
|
+
? {
|
122
|
+
to: (value: any) => JSON.stringify(value),
|
123
|
+
from: (value: string) => JSON.parse(value)
|
124
|
+
}
|
125
|
+
: undefined
|
126
|
+
})
|
127
|
+
@Field(type => ScalarObject, { nullable: true })
|
128
|
+
params?: { [key: string]: any }
|
110
129
|
|
111
130
|
/**
|
112
131
|
* A boolean attribute indicating the inclusion status of an element in the result.
|
@@ -186,8 +205,8 @@ export class StepPatch {
|
|
186
205
|
@Field({ nullable: true })
|
187
206
|
connection?: string
|
188
207
|
|
189
|
-
@Field({ nullable: true })
|
190
|
-
params?: string
|
208
|
+
@Field(type => ScalarObject, { nullable: true })
|
209
|
+
params?: { [key: string]: any }
|
191
210
|
|
192
211
|
@Field({ nullable: true })
|
193
212
|
result?: boolean
|
@@ -201,9 +220,7 @@ export class StepPatch {
|
|
201
220
|
* 추후, 타입 일치를 통해서 제거할 예정임.
|
202
221
|
*
|
203
222
|
*/
|
204
|
-
export interface InputStep extends Step {
|
205
|
-
params: any
|
206
|
-
}
|
223
|
+
export interface InputStep extends Step {}
|
207
224
|
|
208
225
|
@ObjectType()
|
209
226
|
export class StepList {
|