@things-factory/integration-base 8.0.39 → 9.0.0-9.0.0-beta.59.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.
- package/dist-server/engine/connector/headless-connector.d.ts +23 -0
- package/dist-server/engine/connector/headless-connector.js +357 -0
- package/dist-server/engine/connector/headless-connector.js.map +1 -0
- package/dist-server/engine/connector/http-connector.js +1 -1
- package/dist-server/engine/connector/http-connector.js.map +1 -1
- package/dist-server/engine/connector/index.d.ts +1 -0
- package/dist-server/engine/connector/index.js +1 -0
- package/dist-server/engine/connector/index.js.map +1 -1
- package/dist-server/engine/index.d.ts +3 -2
- package/dist-server/engine/index.js +3 -2
- package/dist-server/engine/index.js.map +1 -1
- package/dist-server/engine/resource-pool/headless-pool.d.ts +1 -0
- package/dist-server/engine/resource-pool/headless-pool.js +62 -0
- package/dist-server/engine/resource-pool/headless-pool.js.map +1 -0
- package/dist-server/engine/resource-pool/index.d.ts +1 -0
- package/dist-server/engine/resource-pool/index.js +5 -0
- package/dist-server/engine/resource-pool/index.js.map +1 -0
- package/dist-server/engine/task/headless-post.js +19 -33
- package/dist-server/engine/task/headless-post.js.map +1 -1
- package/dist-server/engine/task/headless-scrap.js +20 -13
- package/dist-server/engine/task/headless-scrap.js.map +1 -1
- package/dist-server/engine/task/mqtt-publish.js +29 -6
- package/dist-server/engine/task/mqtt-publish.js.map +1 -1
- package/dist-server/engine/task/mqtt-subscribe.js +178 -64
- package/dist-server/engine/task/mqtt-subscribe.js.map +1 -1
- package/dist-server/index.d.ts +6 -6
- package/dist-server/index.js +10 -10
- package/dist-server/index.js.map +1 -1
- package/dist-server/routes.js +6 -6
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/connection/connection-mutation.js +17 -5
- package/dist-server/service/connection/connection-mutation.js.map +1 -1
- package/dist-server/service/connection/connection-query.js +3 -0
- package/dist-server/service/connection/connection-query.js.map +1 -1
- package/dist-server/service/index.d.ts +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -11
- package/translations/en.json +12 -4
- package/translations/ja.json +12 -4
- package/translations/ko.json +12 -4
- package/translations/ms.json +12 -4
- package/translations/zh.json +12 -4
- package/server/controllers/index.ts +0 -2
- package/server/controllers/publish-data.ts +0 -29
- package/server/controllers/scenario-controller.ts +0 -154
- package/server/engine/analyzer/analyze-integration.ts +0 -115
- package/server/engine/connection-manager.ts +0 -232
- package/server/engine/connector/echo-back-connector.ts +0 -51
- package/server/engine/connector/echo-back-server.ts +0 -72
- package/server/engine/connector/graphql-connector.ts +0 -126
- package/server/engine/connector/http-connector.ts +0 -65
- package/server/engine/connector/index.ts +0 -12
- package/server/engine/connector/mqtt-connector.ts +0 -78
- package/server/engine/connector/mssql-connector.ts +0 -152
- package/server/engine/connector/mysql-connector.ts +0 -94
- package/server/engine/connector/operato-connector.ts +0 -264
- package/server/engine/connector/oracle-connector.ts +0 -218
- package/server/engine/connector/postgresql-connector.ts +0 -152
- package/server/engine/connector/proxy-connector.ts +0 -53
- package/server/engine/connector/socket-server.ts +0 -86
- package/server/engine/connector/sqlite-connector.ts +0 -69
- package/server/engine/edge-client.ts +0 -45
- package/server/engine/index.ts +0 -10
- package/server/engine/pending-queue.ts +0 -97
- package/server/engine/scenario-engine.ts +0 -106
- package/server/engine/task/book-up-scenario.ts +0 -73
- package/server/engine/task/csv-readline.ts +0 -127
- package/server/engine/task/data-accessor.ts +0 -36
- package/server/engine/task/data-mapper.ts +0 -47
- package/server/engine/task/database-query.ts +0 -56
- package/server/engine/task/echo-receive.ts +0 -21
- package/server/engine/task/echo-send.ts +0 -32
- package/server/engine/task/empty-check.ts +0 -38
- package/server/engine/task/end.ts +0 -18
- package/server/engine/task/floating-point.ts +0 -71
- package/server/engine/task/goto.ts +0 -27
- package/server/engine/task/graphql-mutate.ts +0 -79
- package/server/engine/task/graphql-query.ts +0 -78
- package/server/engine/task/headless-post.ts +0 -147
- package/server/engine/task/headless-scrap.ts +0 -80
- package/server/engine/task/http-get.ts +0 -117
- package/server/engine/task/http-post.ts +0 -148
- package/server/engine/task/index.ts +0 -45
- package/server/engine/task/jsonata.ts +0 -45
- package/server/engine/task/local-graphql-mutate.ts +0 -100
- package/server/engine/task/local-graphql-query.ts +0 -100
- package/server/engine/task/log.ts +0 -78
- package/server/engine/task/mqtt-publish.ts +0 -45
- package/server/engine/task/mqtt-subscribe.ts +0 -139
- package/server/engine/task/mssql-procedure.ts +0 -128
- package/server/engine/task/oracle-procedure.ts +0 -124
- package/server/engine/task/pick-pending-scenario.ts +0 -80
- package/server/engine/task/publish.ts +0 -40
- package/server/engine/task/random.ts +0 -53
- package/server/engine/task/reset-pending-queue.ts +0 -17
- package/server/engine/task/script.ts +0 -63
- package/server/engine/task/set-domain.ts +0 -37
- package/server/engine/task/sleep.ts +0 -34
- package/server/engine/task/socket-listener.ts +0 -96
- package/server/engine/task/state-group-read.ts +0 -69
- package/server/engine/task/state-read.ts +0 -56
- package/server/engine/task/state-write.ts +0 -65
- package/server/engine/task/stop-scenario.ts +0 -44
- package/server/engine/task/sub-scenario.ts +0 -57
- package/server/engine/task/switch-goto.ts +0 -43
- package/server/engine/task/switch-range-goto.ts +0 -53
- package/server/engine/task/switch-range-scenario.ts +0 -79
- package/server/engine/task/switch-range-set.ts +0 -48
- package/server/engine/task/switch-scenario.ts +0 -67
- package/server/engine/task/switch-set.ts +0 -37
- package/server/engine/task/throw.ts +0 -27
- package/server/engine/task/utils/headless-pool-for-scenario.ts +0 -71
- package/server/engine/task/utils/substitute.ts +0 -44
- package/server/engine/task/variables.ts +0 -17
- package/server/engine/task-registry.ts +0 -23
- package/server/engine/types.ts +0 -114
- package/server/index.ts +0 -20
- package/server/migrations/index.ts +0 -9
- package/server/restful/index.ts +0 -1
- package/server/restful/unstable/index.ts +0 -7
- package/server/restful/unstable/run-scenario.ts +0 -51
- package/server/restful/unstable/scenario-instance.ts +0 -52
- package/server/restful/unstable/scenario-instances.ts +0 -80
- package/server/restful/unstable/scenario.ts +0 -41
- package/server/restful/unstable/scenarios.ts +0 -69
- package/server/restful/unstable/start-scenario.ts +0 -33
- package/server/restful/unstable/stop-scenario.ts +0 -30
- package/server/routers/scenario-schedule-callback-router.ts +0 -69
- package/server/routers/scenario-view-router.ts +0 -46
- package/server/routes.ts +0 -35
- package/server/service/analysis/analysis-query.ts +0 -13
- package/server/service/analysis/index.ts +0 -3
- package/server/service/connection/connection-mutation.ts +0 -190
- package/server/service/connection/connection-query.ts +0 -87
- package/server/service/connection/connection-subscription.ts +0 -104
- package/server/service/connection/connection-type.ts +0 -305
- package/server/service/connection/index.ts +0 -7
- package/server/service/connector/connector-query.ts +0 -62
- package/server/service/connector/connector-type.ts +0 -29
- package/server/service/connector/index.ts +0 -4
- package/server/service/index.ts +0 -52
- package/server/service/payload-log/index.ts +0 -7
- package/server/service/payload-log/payload-log-mutation.ts +0 -151
- package/server/service/payload-log/payload-log-query.ts +0 -49
- package/server/service/payload-log/payload-log-type.ts +0 -36
- package/server/service/payload-log/payload-log.ts +0 -100
- package/server/service/property-spec.ts +0 -24
- package/server/service/scenario/index.ts +0 -6
- package/server/service/scenario/scenario-mutation.ts +0 -396
- package/server/service/scenario/scenario-query.ts +0 -109
- package/server/service/scenario/scenario-type.ts +0 -78
- package/server/service/scenario/scenario.ts +0 -124
- package/server/service/scenario-flow/scenario-flow.ts +0 -17
- package/server/service/scenario-instance/index.ts +0 -6
- package/server/service/scenario-instance/scenario-instance-mutation.ts +0 -44
- package/server/service/scenario-instance/scenario-instance-query.ts +0 -42
- package/server/service/scenario-instance/scenario-instance-subscription.ts +0 -118
- package/server/service/scenario-instance/scenario-instance-type.ts +0 -557
- package/server/service/scenario-queue/index.ts +0 -4
- package/server/service/scenario-queue/scenario-queue-subscription.ts +0 -55
- package/server/service/scenario-queue/scenario-queue-type.ts +0 -27
- package/server/service/state-register/data-resolver.ts +0 -56
- package/server/service/state-register/index.ts +0 -8
- package/server/service/state-register/state-register-mutation.ts +0 -166
- package/server/service/state-register/state-register-query.ts +0 -80
- package/server/service/state-register/state-register-type.ts +0 -80
- package/server/service/state-register/state-register.ts +0 -113
- package/server/service/step/index.ts +0 -6
- package/server/service/step/step-mutation.ts +0 -52
- package/server/service/step/step-query.ts +0 -55
- package/server/service/step/step-type.ts +0 -238
- package/server/service/task-type/index.ts +0 -4
- package/server/service/task-type/task-type-query.ts +0 -95
- package/server/service/task-type/task-type-type.ts +0 -29
@@ -1,305 +0,0 @@
|
|
1
|
-
import { Field, ID, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'
|
2
|
-
import {
|
3
|
-
Column,
|
4
|
-
CreateDateColumn,
|
5
|
-
Entity,
|
6
|
-
Index,
|
7
|
-
ManyToOne,
|
8
|
-
PrimaryGeneratedColumn,
|
9
|
-
RelationId,
|
10
|
-
UpdateDateColumn
|
11
|
-
} from 'typeorm'
|
12
|
-
|
13
|
-
import { User, Appliance } from '@things-factory/auth-base'
|
14
|
-
import { config } from '@things-factory/env'
|
15
|
-
import { Domain, ObjectRef, ScalarObject } from '@things-factory/shell'
|
16
|
-
|
17
|
-
import { ConnectionManager } from '../../engine'
|
18
|
-
import { ProxyConnector } from '../../engine/connector/proxy-connector'
|
19
|
-
|
20
|
-
const ORMCONFIG = config.get('ormconfig', {})
|
21
|
-
const DATABASE_TYPE = ORMCONFIG.type
|
22
|
-
|
23
|
-
export enum ConnectionStatus {
|
24
|
-
CONNECTED = 'CONNECTED',
|
25
|
-
DISCONNECTED = 'DISCONNECTED'
|
26
|
-
}
|
27
|
-
|
28
|
-
registerEnumType(ConnectionStatus, {
|
29
|
-
name: 'ConnectionStatus',
|
30
|
-
description: 'state enumeration of a connection'
|
31
|
-
})
|
32
|
-
|
33
|
-
@Entity()
|
34
|
-
@Index('ix_connection_0', (connection: Connection) => [connection.domain, connection.name], { unique: true })
|
35
|
-
@ObjectType()
|
36
|
-
export class Connection {
|
37
|
-
/**
|
38
|
-
* Unique identifier for the connection, generated in UUID format.
|
39
|
-
*/
|
40
|
-
@PrimaryGeneratedColumn('uuid')
|
41
|
-
@Field(type => ID)
|
42
|
-
readonly id: string
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Many-to-One relationship with the Domain entity.
|
46
|
-
*/
|
47
|
-
@ManyToOne(type => Domain)
|
48
|
-
@Field(type => Domain, { nullable: true })
|
49
|
-
domain: Domain
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Stores the ID of the associated Domain.
|
53
|
-
*/
|
54
|
-
@RelationId((connection: Connection) => connection.domain)
|
55
|
-
domainId: string
|
56
|
-
|
57
|
-
/**
|
58
|
-
* The name of the connection.
|
59
|
-
*/
|
60
|
-
@Column()
|
61
|
-
@Field()
|
62
|
-
name: string
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Optional description for the connection.
|
66
|
-
*/
|
67
|
-
@Column({
|
68
|
-
nullable: true
|
69
|
-
})
|
70
|
-
@Field({ nullable: true })
|
71
|
-
description: string
|
72
|
-
|
73
|
-
/**
|
74
|
-
* The type of the connection.
|
75
|
-
*/
|
76
|
-
@Column()
|
77
|
-
@Field({ nullable: true })
|
78
|
-
type: string
|
79
|
-
|
80
|
-
/**
|
81
|
-
* Many-to-One relationship with the Appliance entity which delegate the connection. Optional field.
|
82
|
-
*/
|
83
|
-
@ManyToOne(type => Appliance, { nullable: true })
|
84
|
-
@Field({ nullable: true })
|
85
|
-
edge: Appliance
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Stores the ID of the Appliance who delegate the connection.
|
89
|
-
*/
|
90
|
-
@RelationId((connection: Connection) => connection.edge)
|
91
|
-
edgeId: string
|
92
|
-
|
93
|
-
/**
|
94
|
-
* The endpoint for the connection.
|
95
|
-
*/
|
96
|
-
@Column()
|
97
|
-
@Field({ nullable: true })
|
98
|
-
endpoint: string
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Indicates the active status of the connection.
|
102
|
-
*/
|
103
|
-
@Column({ nullable: true })
|
104
|
-
@Field({ nullable: true })
|
105
|
-
active: boolean
|
106
|
-
|
107
|
-
/**
|
108
|
-
* The status of the connection, using the ConnectionStatus type.
|
109
|
-
*/
|
110
|
-
@Field({ nullable: true })
|
111
|
-
state: ConnectionStatus
|
112
|
-
|
113
|
-
/**
|
114
|
-
* Additional parameters for the connection, stored as a JSON string.
|
115
|
-
*
|
116
|
-
* [Caution]
|
117
|
-
* 이 컬럼타입은 postgres 데이터베이스에서는 varchar 타입을 유지한다.
|
118
|
-
* 이는 데이터베이스 타입을 변경하면 기존 데이터가 손실될 수 있기 때문이다.
|
119
|
-
* 'simple-json' 타입으로 변경 전에 postgres 데이타베이스에 이미 varchar 타입으로 사용한 사례가 많기 때문이다.
|
120
|
-
*/
|
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) => {
|
129
|
-
try {
|
130
|
-
return JSON.parse(value)
|
131
|
-
} catch (error) {
|
132
|
-
return null
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
: undefined
|
137
|
-
})
|
138
|
-
@Field(type => ScalarObject, { nullable: true })
|
139
|
-
params: { [key: string]: any }
|
140
|
-
|
141
|
-
/**
|
142
|
-
* The date and time when the connection was created.
|
143
|
-
*/
|
144
|
-
@CreateDateColumn()
|
145
|
-
@Field({ nullable: true })
|
146
|
-
createdAt: Date
|
147
|
-
|
148
|
-
/**
|
149
|
-
* The date and time when the connection was last updated.
|
150
|
-
*/
|
151
|
-
@UpdateDateColumn()
|
152
|
-
@Field({ nullable: true })
|
153
|
-
updatedAt: Date
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Many-to-One relationship with the User entity who created the connection. Optional field.
|
157
|
-
*/
|
158
|
-
@ManyToOne(type => User, { nullable: true })
|
159
|
-
@Field({ nullable: true })
|
160
|
-
creator: User
|
161
|
-
|
162
|
-
/**
|
163
|
-
* Stores the ID of the User who created the connection.
|
164
|
-
*/
|
165
|
-
@RelationId((connection: Connection) => connection.creator)
|
166
|
-
creatorId: string
|
167
|
-
|
168
|
-
/**
|
169
|
-
* Many-to-One relationship with the User entity who last updated the connection.
|
170
|
-
* Optional field.
|
171
|
-
*/
|
172
|
-
@ManyToOne(type => User, { nullable: true })
|
173
|
-
@Field({ nullable: true })
|
174
|
-
updater: User
|
175
|
-
|
176
|
-
/**
|
177
|
-
* Stores the ID of the User who last updated the connection.
|
178
|
-
*
|
179
|
-
*/
|
180
|
-
@RelationId((connection: Connection) => connection.updater)
|
181
|
-
updaterId: string
|
182
|
-
|
183
|
-
/**
|
184
|
-
* Asynchronous method to establish the connection.
|
185
|
-
*
|
186
|
-
*/
|
187
|
-
async connect() {
|
188
|
-
const { type, edge } = this
|
189
|
-
const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(type)
|
190
|
-
|
191
|
-
await connector.connect({
|
192
|
-
...this,
|
193
|
-
params: this.params || {}
|
194
|
-
})
|
195
|
-
}
|
196
|
-
|
197
|
-
/**
|
198
|
-
* @brief Asynchronous method to disconnect the connection.
|
199
|
-
*
|
200
|
-
*/
|
201
|
-
async disconnect() {
|
202
|
-
try {
|
203
|
-
const { type, edge } = this
|
204
|
-
const connector = edge ? ProxyConnector.instance : ConnectionManager.getConnector(type)
|
205
|
-
await connector.disconnect(this)
|
206
|
-
} finally {
|
207
|
-
}
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
/**
|
212
|
-
* Connection의 params의 원 타입과 사용 시에 타입 불일치로 인해 임시적으로 생성한 타입으로
|
213
|
-
* 추후, 타입 일치를 통해서 제거할 예정임.
|
214
|
-
*
|
215
|
-
*/
|
216
|
-
export interface InputConnection extends Connection {
|
217
|
-
params: any
|
218
|
-
}
|
219
|
-
|
220
|
-
@ObjectType()
|
221
|
-
export class ConnectionState {
|
222
|
-
@Field(type => Domain)
|
223
|
-
domain?: Domain
|
224
|
-
|
225
|
-
@Field({ nullable: true })
|
226
|
-
id?: string
|
227
|
-
|
228
|
-
@Field({ nullable: true })
|
229
|
-
name?: string
|
230
|
-
|
231
|
-
@Field({ nullable: true })
|
232
|
-
description?: string
|
233
|
-
|
234
|
-
@Field({ nullable: true })
|
235
|
-
type?: string
|
236
|
-
|
237
|
-
@Field(type => Appliance, { nullable: true })
|
238
|
-
edge?: Appliance
|
239
|
-
|
240
|
-
@Field({ nullable: true })
|
241
|
-
state?: ConnectionStatus
|
242
|
-
|
243
|
-
@Field({ nullable: true })
|
244
|
-
timestamp?: Date
|
245
|
-
}
|
246
|
-
|
247
|
-
@InputType()
|
248
|
-
export class NewConnection {
|
249
|
-
@Field()
|
250
|
-
name: string
|
251
|
-
|
252
|
-
@Field({ nullable: true })
|
253
|
-
description?: string
|
254
|
-
|
255
|
-
@Field({ nullable: true })
|
256
|
-
type?: string
|
257
|
-
|
258
|
-
@Field(type => ObjectRef, { nullable: true })
|
259
|
-
edge?: Appliance
|
260
|
-
|
261
|
-
@Field({ nullable: true })
|
262
|
-
endpoint?: string
|
263
|
-
|
264
|
-
@Field(type => ScalarObject, { nullable: true })
|
265
|
-
params?: { [key: string]: any }
|
266
|
-
}
|
267
|
-
|
268
|
-
@InputType()
|
269
|
-
export class ConnectionPatch {
|
270
|
-
@Field(type => ID, { nullable: true })
|
271
|
-
id: string
|
272
|
-
|
273
|
-
@Field({ nullable: true })
|
274
|
-
name?: string
|
275
|
-
|
276
|
-
@Field({ nullable: true })
|
277
|
-
description?: string
|
278
|
-
|
279
|
-
@Field({ nullable: true })
|
280
|
-
type?: string
|
281
|
-
|
282
|
-
@Field(type => ObjectRef, { nullable: true })
|
283
|
-
edge?: Appliance
|
284
|
-
|
285
|
-
@Field({ nullable: true })
|
286
|
-
endpoint?: string
|
287
|
-
|
288
|
-
@Field({ nullable: true })
|
289
|
-
active?: boolean
|
290
|
-
|
291
|
-
@Field(type => ScalarObject, { nullable: true })
|
292
|
-
params?: { [key: string]: any }
|
293
|
-
|
294
|
-
@Field({ nullable: true })
|
295
|
-
cuFlag?: string
|
296
|
-
}
|
297
|
-
|
298
|
-
@ObjectType()
|
299
|
-
export class ConnectionList {
|
300
|
-
@Field(type => [Connection])
|
301
|
-
items: Connection[]
|
302
|
-
|
303
|
-
@Field(type => Int)
|
304
|
-
total: number
|
305
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { Connection } from './connection-type'
|
2
|
-
import { ConnectionQuery } from './connection-query'
|
3
|
-
import { ConnectionMutation } from './connection-mutation'
|
4
|
-
import { ConnectionSubscription } from './connection-subscription'
|
5
|
-
|
6
|
-
export const entities = [Connection]
|
7
|
-
export const resolvers = [ConnectionQuery, ConnectionMutation, ConnectionSubscription]
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import { Arg, Ctx, Query, Resolver } from 'type-graphql'
|
2
|
-
|
3
|
-
import { getRepository } from '@things-factory/shell'
|
4
|
-
|
5
|
-
import { ConnectionManager } from '../../engine/connection-manager'
|
6
|
-
import { Connection } from '../connection/connection-type'
|
7
|
-
import { ConnectorList, ConnectorType } from './connector-type'
|
8
|
-
|
9
|
-
@Resolver(ConnectorType)
|
10
|
-
export class ConnectorQuery {
|
11
|
-
@Query(returns => ConnectorType, { description: 'To fetch a connector' })
|
12
|
-
async connection(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<ConnectorType> {
|
13
|
-
// @ts-ignore
|
14
|
-
const { description, help, parameterSpec, taskPrefixes } = ConnectionManager.getConnector(name) || {}
|
15
|
-
|
16
|
-
return {
|
17
|
-
name,
|
18
|
-
description,
|
19
|
-
help,
|
20
|
-
parameterSpec,
|
21
|
-
taskPrefixes: taskPrefixes || []
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
@Query(returns => ConnectorList, { description: 'To fetch multiple connector' })
|
26
|
-
async connectors(): Promise<ConnectorList> {
|
27
|
-
var connectors = ConnectionManager.getConnectors()
|
28
|
-
var items = Object.keys(connectors)
|
29
|
-
.map(name => {
|
30
|
-
var connector = connectors[name]
|
31
|
-
return {
|
32
|
-
name,
|
33
|
-
description: connector.description,
|
34
|
-
help: connector.help,
|
35
|
-
parameterSpec: connector.parameterSpec,
|
36
|
-
taskPrefixes: connector.taskPrefixes || []
|
37
|
-
}
|
38
|
-
})
|
39
|
-
.sort((x, y) => {
|
40
|
-
return x.name < y.name ? -1 : 1
|
41
|
-
})
|
42
|
-
|
43
|
-
return {
|
44
|
-
items,
|
45
|
-
total: items.length
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
@Query(returns => ConnectorType, { description: 'To fetch the connector from a connection' })
|
50
|
-
async connectorByConnection(
|
51
|
-
@Arg('connectionName') connectionName: string,
|
52
|
-
@Ctx() context: ResolverContext
|
53
|
-
): Promise<ConnectorType> {
|
54
|
-
const { domain } = context.state
|
55
|
-
|
56
|
-
var connection = await getRepository(Connection).findOne({
|
57
|
-
where: { domain: { id: domain.id }, name: connectionName }
|
58
|
-
})
|
59
|
-
|
60
|
-
return connection && (ConnectionManager.getConnector(connection.type) as any)
|
61
|
-
}
|
62
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { ObjectType, Field, Int } from 'type-graphql'
|
2
|
-
import { PropertySpec } from '../property-spec'
|
3
|
-
|
4
|
-
@ObjectType()
|
5
|
-
export class ConnectorType {
|
6
|
-
@Field()
|
7
|
-
name: string
|
8
|
-
|
9
|
-
@Field({ nullable: true })
|
10
|
-
description: string
|
11
|
-
|
12
|
-
@Field({ nullable: true })
|
13
|
-
help?: string
|
14
|
-
|
15
|
-
@Field(type => [PropertySpec], { nullable: true })
|
16
|
-
parameterSpec: PropertySpec[]
|
17
|
-
|
18
|
-
@Field(type => [String], { nullable: true })
|
19
|
-
taskPrefixes?: string[]
|
20
|
-
}
|
21
|
-
|
22
|
-
@ObjectType()
|
23
|
-
export class ConnectorList {
|
24
|
-
@Field(type => [ConnectorType])
|
25
|
-
items: ConnectorType[]
|
26
|
-
|
27
|
-
@Field(type => Int)
|
28
|
-
total: number
|
29
|
-
}
|
package/server/service/index.ts
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
import { entities as ConnectionEntities, resolvers as ConnectionResolvers } from './connection'
|
2
|
-
import { entities as ConnectorEntities, resolvers as ConnectorResolvers } from './connector'
|
3
|
-
import { entities as ScenarioEntities, resolvers as ScenarioResolvers } from './scenario'
|
4
|
-
import { entities as ScenarioInstanceEntities, resolvers as ScenarioInstanceResolvers } from './scenario-instance'
|
5
|
-
import { entities as ScenarioQueueEntities, resolvers as ScenarioQueueResolvers } from './scenario-queue'
|
6
|
-
import { entities as StepEntities, resolvers as StepResolvers } from './step'
|
7
|
-
import { entities as TaskTypeEntities, resolvers as TaskTypeResolvers } from './task-type'
|
8
|
-
import { entities as PayloadLogEntities, resolvers as PayloadLogResolvers } from './payload-log'
|
9
|
-
import { entities as StateRegisterEntities, resolvers as StateRegisterResolvers } from './state-register'
|
10
|
-
import { resolvers as IntegrationAnalysisQuery } from './analysis'
|
11
|
-
|
12
|
-
export * from './property-spec'
|
13
|
-
export * from './task-type/task-type-type'
|
14
|
-
export * from './connector/connector-type'
|
15
|
-
export * from './connection/connection-type'
|
16
|
-
export * from './scenario/scenario'
|
17
|
-
export * from './scenario-instance/scenario-instance-type'
|
18
|
-
export * from './scenario-queue/scenario-queue-type'
|
19
|
-
export * from './step/step-type'
|
20
|
-
export * from './scenario-flow/scenario-flow'
|
21
|
-
export * from './payload-log/payload-log'
|
22
|
-
export * from './state-register/state-register'
|
23
|
-
|
24
|
-
export const entities = [
|
25
|
-
...TaskTypeEntities,
|
26
|
-
...ConnectorEntities,
|
27
|
-
...ConnectionEntities,
|
28
|
-
...ScenarioEntities,
|
29
|
-
...ScenarioInstanceEntities,
|
30
|
-
...ScenarioQueueEntities,
|
31
|
-
...StepEntities,
|
32
|
-
...PayloadLogEntities,
|
33
|
-
...StateRegisterEntities
|
34
|
-
]
|
35
|
-
|
36
|
-
export const schema = {
|
37
|
-
resolverClasses: [
|
38
|
-
...TaskTypeResolvers,
|
39
|
-
...ConnectorResolvers,
|
40
|
-
...ConnectionResolvers,
|
41
|
-
...ScenarioResolvers,
|
42
|
-
...ScenarioInstanceResolvers,
|
43
|
-
...ScenarioQueueResolvers,
|
44
|
-
...StepResolvers,
|
45
|
-
...PayloadLogResolvers,
|
46
|
-
...IntegrationAnalysisQuery,
|
47
|
-
...StateRegisterResolvers
|
48
|
-
]
|
49
|
-
}
|
50
|
-
|
51
|
-
export { PayloadType } from './payload-log/payload-log'
|
52
|
-
export { createPayloadLog } from './payload-log/payload-log-mutation'
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { PayloadLog } from './payload-log'
|
2
|
-
import { PayloadLogQuery } from './payload-log-query'
|
3
|
-
import { PayloadLogMutation } from './payload-log-mutation'
|
4
|
-
|
5
|
-
export const entities = [PayloadLog]
|
6
|
-
export const resolvers = [PayloadLogQuery, PayloadLogMutation]
|
7
|
-
|
@@ -1,151 +0,0 @@
|
|
1
|
-
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
2
|
-
import { In } from 'typeorm'
|
3
|
-
|
4
|
-
import { User } from '@things-factory/auth-base'
|
5
|
-
import { logger } from '@things-factory/env'
|
6
|
-
import { Domain, getRepository } from '@things-factory/shell'
|
7
|
-
|
8
|
-
import { PayloadLog, PayloadType } from './payload-log'
|
9
|
-
import { NewPayloadLog, PayloadLogPatch } from './payload-log-type'
|
10
|
-
|
11
|
-
@Resolver(PayloadLog)
|
12
|
-
export class PayloadLogMutation {
|
13
|
-
@Directive('@transaction')
|
14
|
-
@Mutation(returns => PayloadLog, { description: 'To create new PayloadLog' })
|
15
|
-
async createPayloadLog(
|
16
|
-
@Arg('payloadLog') payloadLog: NewPayloadLog,
|
17
|
-
@Ctx() context: ResolverContext
|
18
|
-
): Promise<PayloadLog> {
|
19
|
-
const { domain, user, tx } = context.state
|
20
|
-
|
21
|
-
return await tx.getRepository(PayloadLog).save({
|
22
|
-
...payloadLog,
|
23
|
-
domain,
|
24
|
-
creator: user,
|
25
|
-
updater: user
|
26
|
-
})
|
27
|
-
}
|
28
|
-
|
29
|
-
@Directive('@transaction')
|
30
|
-
@Mutation(returns => PayloadLog, { description: 'To modify PayloadLog information' })
|
31
|
-
async updatePayloadLog(
|
32
|
-
@Arg('id') id: string,
|
33
|
-
@Arg('patch') patch: PayloadLogPatch,
|
34
|
-
@Ctx() context: ResolverContext
|
35
|
-
): Promise<PayloadLog> {
|
36
|
-
const { domain, user, tx } = context.state
|
37
|
-
|
38
|
-
const repository = tx.getRepository(PayloadLog)
|
39
|
-
const payloadLog = await repository.findOne({
|
40
|
-
where: { domain: { id: domain.id }, id }
|
41
|
-
})
|
42
|
-
|
43
|
-
return await repository.save({
|
44
|
-
...payloadLog,
|
45
|
-
...patch,
|
46
|
-
updater: user
|
47
|
-
})
|
48
|
-
}
|
49
|
-
|
50
|
-
@Directive('@transaction')
|
51
|
-
@Mutation(returns => [PayloadLog], { description: "To modify multiple PayloadLogs' information" })
|
52
|
-
async updateMultiplePayloadLog(
|
53
|
-
@Arg('patches', type => [PayloadLogPatch]) patches: PayloadLogPatch[],
|
54
|
-
@Ctx() context: ResolverContext
|
55
|
-
): Promise<PayloadLog[]> {
|
56
|
-
const { domain, user, tx } = context.state
|
57
|
-
|
58
|
-
let results = []
|
59
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
60
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
61
|
-
const payloadLogRepo = tx.getRepository(PayloadLog)
|
62
|
-
|
63
|
-
if (_createRecords.length > 0) {
|
64
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
65
|
-
const newRecord = _createRecords[i]
|
66
|
-
|
67
|
-
const result = await payloadLogRepo.save({
|
68
|
-
...newRecord,
|
69
|
-
domain,
|
70
|
-
creator: user,
|
71
|
-
updater: user
|
72
|
-
})
|
73
|
-
|
74
|
-
results.push({ ...result, cuFlag: '+' })
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
if (_updateRecords.length > 0) {
|
79
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
80
|
-
const newRecord = _updateRecords[i]
|
81
|
-
const payloadLog = await payloadLogRepo.findOneBy({ id: newRecord.id })
|
82
|
-
|
83
|
-
const result = await payloadLogRepo.save({
|
84
|
-
...payloadLog,
|
85
|
-
...newRecord,
|
86
|
-
updater: user
|
87
|
-
})
|
88
|
-
|
89
|
-
results.push({ ...result, cuFlag: 'M' })
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
return results
|
94
|
-
}
|
95
|
-
|
96
|
-
@Directive('@transaction')
|
97
|
-
@Mutation(returns => Boolean, { description: 'To delete PayloadLog' })
|
98
|
-
async deletePayloadLog(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
99
|
-
const { domain, tx } = context.state
|
100
|
-
|
101
|
-
await tx.getRepository(PayloadLog).delete({ domain: { id: domain.id }, id })
|
102
|
-
return true
|
103
|
-
}
|
104
|
-
|
105
|
-
@Directive('@transaction')
|
106
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple payloadLogs' })
|
107
|
-
async deletePayloadLogs(
|
108
|
-
@Arg('ids', type => [String]) ids: string[],
|
109
|
-
@Ctx() context: ResolverContext
|
110
|
-
): Promise<boolean> {
|
111
|
-
const { domain, tx } = context.state
|
112
|
-
|
113
|
-
await tx.getRepository(PayloadLog).delete({
|
114
|
-
domain: { id: domain.id },
|
115
|
-
id: In(ids)
|
116
|
-
})
|
117
|
-
|
118
|
-
return true
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
export async function createPayloadLog(
|
123
|
-
name: string,
|
124
|
-
endpoint: string,
|
125
|
-
request: string,
|
126
|
-
response: string,
|
127
|
-
context: any,
|
128
|
-
type: PayloadType = PayloadType.EGESTION,
|
129
|
-
src: string = null
|
130
|
-
): Promise<void> {
|
131
|
-
try {
|
132
|
-
const { domain, user }: { domain: Domain; user: User } = context?.state
|
133
|
-
|
134
|
-
// disabled due to high db server usage
|
135
|
-
await getRepository(PayloadLog).save({
|
136
|
-
name,
|
137
|
-
domain,
|
138
|
-
endpoint,
|
139
|
-
request,
|
140
|
-
response,
|
141
|
-
type,
|
142
|
-
src,
|
143
|
-
createdBy: user,
|
144
|
-
updatedBy: user,
|
145
|
-
createdAt: new Date(),
|
146
|
-
updatedAt: new Date()
|
147
|
-
})
|
148
|
-
} catch (error) {
|
149
|
-
logger.error(`PayloadLog Error`, error)
|
150
|
-
}
|
151
|
-
}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
2
|
-
|
3
|
-
import { User } from '@things-factory/auth-base'
|
4
|
-
import { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'
|
5
|
-
|
6
|
-
import { PayloadLog } from './payload-log'
|
7
|
-
import { PayloadLogList } from './payload-log-type'
|
8
|
-
|
9
|
-
@Resolver(PayloadLog)
|
10
|
-
export class PayloadLogQuery {
|
11
|
-
@Query(returns => PayloadLog, { description: 'To fetch a PayloadLog' })
|
12
|
-
async payloadLog(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<PayloadLog> {
|
13
|
-
const { domain } = context.state
|
14
|
-
|
15
|
-
return await getRepository(PayloadLog).findOne({
|
16
|
-
where: { domain: { id: domain.id }, id }
|
17
|
-
})
|
18
|
-
}
|
19
|
-
|
20
|
-
@Query(returns => PayloadLogList, { description: 'To fetch multiple PayloadLogs' })
|
21
|
-
async payloadLogs(
|
22
|
-
@Args(type => ListParam) params: ListParam,
|
23
|
-
@Ctx() context: ResolverContext
|
24
|
-
): Promise<PayloadLogList> {
|
25
|
-
const { domain } = context.state
|
26
|
-
|
27
|
-
const convertedParams = convertListParams(params, {
|
28
|
-
domain
|
29
|
-
})
|
30
|
-
const [items, total] = await getRepository(PayloadLog).findAndCount(convertedParams)
|
31
|
-
|
32
|
-
return { items, total }
|
33
|
-
}
|
34
|
-
|
35
|
-
@FieldResolver(type => Domain)
|
36
|
-
async domain(@Root() payloadLog: PayloadLog): Promise<Domain> {
|
37
|
-
return await getRepository(Domain).findOneBy({ id: payloadLog.domainId })
|
38
|
-
}
|
39
|
-
|
40
|
-
@FieldResolver(type => User)
|
41
|
-
async updater(@Root() payloadLog: PayloadLog): Promise<User> {
|
42
|
-
return await getRepository(User).findOneBy({ id: payloadLog.updaterId })
|
43
|
-
}
|
44
|
-
|
45
|
-
@FieldResolver(type => User)
|
46
|
-
async creator(@Root() payloadLog: PayloadLog): Promise<User> {
|
47
|
-
return await getRepository(User).findOneBy({ id: payloadLog.creatorId })
|
48
|
-
}
|
49
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
2
|
-
|
3
|
-
import { PayloadLog } from './payload-log'
|
4
|
-
|
5
|
-
@InputType()
|
6
|
-
export class NewPayloadLog {
|
7
|
-
@Field()
|
8
|
-
name: string
|
9
|
-
|
10
|
-
@Field({ nullable: true })
|
11
|
-
description?: string
|
12
|
-
}
|
13
|
-
|
14
|
-
@InputType()
|
15
|
-
export class PayloadLogPatch {
|
16
|
-
@Field(type => ID, { nullable: true })
|
17
|
-
id?: string
|
18
|
-
|
19
|
-
@Field({ nullable: true })
|
20
|
-
name?: string
|
21
|
-
|
22
|
-
@Field({ nullable: true })
|
23
|
-
description?: string
|
24
|
-
|
25
|
-
@Field()
|
26
|
-
cuFlag: string
|
27
|
-
}
|
28
|
-
|
29
|
-
@ObjectType()
|
30
|
-
export class PayloadLogList {
|
31
|
-
@Field(type => [PayloadLog])
|
32
|
-
items: PayloadLog[]
|
33
|
-
|
34
|
-
@Field(type => Int)
|
35
|
-
total: number
|
36
|
-
}
|