@things-factory/integration-base 7.0.0-alpha.1 → 7.0.0-alpha.21

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.
Files changed (86) hide show
  1. package/dist-server/controllers/index.js +5 -0
  2. package/dist-server/controllers/index.js.map +1 -0
  3. package/dist-server/controllers/scenario-controller.js +87 -0
  4. package/dist-server/controllers/scenario-controller.js.map +1 -0
  5. package/dist-server/engine/connection-manager.js +37 -6
  6. package/dist-server/engine/connection-manager.js.map +1 -1
  7. package/dist-server/engine/connector/graphql-connector.js +6 -6
  8. package/dist-server/engine/connector/graphql-connector.js.map +1 -1
  9. package/dist-server/engine/connector/operato-connector.js +19 -22
  10. package/dist-server/engine/connector/operato-connector.js.map +1 -1
  11. package/dist-server/engine/connector/oracle-connector.js +113 -17
  12. package/dist-server/engine/connector/oracle-connector.js.map +1 -1
  13. package/dist-server/engine/connector/proxy-connector.js +44 -0
  14. package/dist-server/engine/connector/proxy-connector.js.map +1 -0
  15. package/dist-server/engine/edge-client.js +38 -0
  16. package/dist-server/engine/edge-client.js.map +1 -0
  17. package/dist-server/engine/index.js +1 -0
  18. package/dist-server/engine/index.js.map +1 -1
  19. package/dist-server/engine/task/oracle-procedure.js +1 -15
  20. package/dist-server/engine/task/oracle-procedure.js.map +1 -1
  21. package/dist-server/engine/task/script.js +1 -0
  22. package/dist-server/engine/task/script.js.map +1 -1
  23. package/dist-server/engine/task/utils/headless-pool-for-scenario.js +1 -1
  24. package/dist-server/engine/task/utils/headless-pool-for-scenario.js.map +1 -1
  25. package/dist-server/engine/types.js.map +1 -1
  26. package/dist-server/index.js +1 -0
  27. package/dist-server/index.js.map +1 -1
  28. package/dist-server/restful/unstable/run-scenario.js.map +1 -1
  29. package/dist-server/restful/unstable/start-scenario.js +1 -1
  30. package/dist-server/restful/unstable/start-scenario.js.map +1 -1
  31. package/dist-server/restful/unstable/stop-scenario.js +1 -1
  32. package/dist-server/restful/unstable/stop-scenario.js.map +1 -1
  33. package/dist-server/service/connection/connection-mutation.js +4 -8
  34. package/dist-server/service/connection/connection-mutation.js.map +1 -1
  35. package/dist-server/service/connection/connection-query.js +17 -14
  36. package/dist-server/service/connection/connection-query.js.map +1 -1
  37. package/dist-server/service/connection/connection-subscription.js +2 -2
  38. package/dist-server/service/connection/connection-subscription.js.map +1 -1
  39. package/dist-server/service/connection/connection-type.js +32 -8
  40. package/dist-server/service/connection/connection-type.js.map +1 -1
  41. package/dist-server/service/scenario-instance/scenario-instance-mutation.js +4 -71
  42. package/dist-server/service/scenario-instance/scenario-instance-mutation.js.map +1 -1
  43. package/dist-server/service/scenario-instance/scenario-instance-type.js +18 -5
  44. package/dist-server/service/scenario-instance/scenario-instance-type.js.map +1 -1
  45. package/dist-server/tsconfig.tsbuildinfo +1 -1
  46. package/helps/integration/concept/script-internal-variables.ja.md +21 -1
  47. package/helps/integration/concept/script-internal-variables.ko.md +17 -0
  48. package/helps/integration/concept/script-internal-variables.md +18 -0
  49. package/helps/integration/concept/script-internal-variables.ms.md +19 -1
  50. package/helps/integration/concept/script-internal-variables.zh.md +18 -0
  51. package/helps/integration/connector/oracle-connector.ja.md +90 -0
  52. package/helps/integration/connector/oracle-connector.ko.md +87 -0
  53. package/helps/integration/connector/oracle-connector.md +46 -25
  54. package/helps/integration/connector/oracle-connector.ms.md +87 -0
  55. package/helps/integration/connector/oracle-connector.zh.md +87 -0
  56. package/helps/integration/task/script.ja.md +1 -1
  57. package/helps/integration/task/script.ko.md +1 -1
  58. package/helps/integration/task/script.md +1 -1
  59. package/helps/integration/task/script.ms.md +1 -1
  60. package/helps/integration/task/script.zh.md +1 -1
  61. package/openapi/unstable/scenario.yaml +100 -100
  62. package/openapi/unstable.yaml +11 -11
  63. package/package.json +7 -11
  64. package/server/controllers/index.ts +1 -0
  65. package/server/controllers/scenario-controller.ts +116 -0
  66. package/server/engine/connection-manager.ts +49 -7
  67. package/server/engine/connector/graphql-connector.ts +8 -10
  68. package/server/engine/connector/operato-connector.ts +22 -32
  69. package/server/engine/connector/oracle-connector.ts +132 -22
  70. package/server/engine/connector/proxy-connector.ts +53 -0
  71. package/server/engine/edge-client.ts +45 -0
  72. package/server/engine/index.ts +1 -0
  73. package/server/engine/task/oracle-procedure.ts +1 -16
  74. package/server/engine/task/script.ts +1 -0
  75. package/server/engine/task/utils/headless-pool-for-scenario.ts +1 -1
  76. package/server/engine/types.ts +45 -46
  77. package/server/index.ts +1 -0
  78. package/server/restful/unstable/run-scenario.ts +0 -1
  79. package/server/restful/unstable/start-scenario.ts +1 -1
  80. package/server/restful/unstable/stop-scenario.ts +1 -1
  81. package/server/service/connection/connection-mutation.ts +9 -29
  82. package/server/service/connection/connection-query.ts +13 -12
  83. package/server/service/connection/connection-subscription.ts +2 -2
  84. package/server/service/connection/connection-type.ts +53 -41
  85. package/server/service/scenario-instance/scenario-instance-mutation.ts +10 -121
  86. package/server/service/scenario-instance/scenario-instance-type.ts +24 -13
@@ -23,10 +23,6 @@ const defaultOptions: any = {
23
23
  }
24
24
  }
25
25
 
26
- const cache = new InMemoryCache({
27
- addTypename: false
28
- })
29
-
30
26
  export class GraphqlConnector implements Connector {
31
27
  async ready(connectionConfigs: InputConnection[]) {
32
28
  await Promise.all(connectionConfigs.map(this.connect.bind(this)))
@@ -35,12 +31,12 @@ export class GraphqlConnector implements Connector {
35
31
  }
36
32
 
37
33
  async connect(connection: InputConnection) {
38
- var {
34
+ const {
39
35
  endpoint: uri,
40
36
  params: { authClient }
41
37
  } = connection
42
38
 
43
- var ERROR_HANDLER: any = ({ graphQLErrors, networkError }) => {
39
+ const ERROR_HANDLER: any = ({ graphQLErrors, networkError }) => {
44
40
  if (graphQLErrors)
45
41
  graphQLErrors.map(({ message, locations, path }) => {
46
42
  ConnectionManager.logger.error(`[GraphQL error] Message: ${message}, Location: ${locations}, Path: ${path}`)
@@ -65,6 +61,10 @@ export class GraphqlConnector implements Connector {
65
61
  return forward(operation)
66
62
  })
67
63
 
64
+ const cache = new InMemoryCache({
65
+ addTypename: false
66
+ })
67
+
68
68
  ConnectionManager.addConnectionInstance(
69
69
  connection,
70
70
  new ApolloClient({
@@ -81,13 +81,11 @@ export class GraphqlConnector implements Connector {
81
81
  })
82
82
  )
83
83
 
84
- ConnectionManager.logger.info(
85
- `graphql-connector connection(${connection.name}:${connection.endpoint}) is connected`
86
- )
84
+ ConnectionManager.logger.info(`graphql-connector connection(${connection.name}:${connection.endpoint}) is connected`)
87
85
  }
88
86
 
89
87
  async disconnect(connection: InputConnection) {
90
- var client = ConnectionManager.getConnectionInstance(connection)
88
+ const client = ConnectionManager.getConnectionInstance(connection)
91
89
  client.stop()
92
90
  ConnectionManager.removeConnectionInstance(connection)
93
91
 
@@ -3,7 +3,6 @@ import 'cross-fetch/polyfill'
3
3
  import { ApolloClient, InMemoryCache, createHttpLink, split } from '@apollo/client/core'
4
4
  import { setContext } from '@apollo/client/link/context'
5
5
 
6
- // for subscription
7
6
  import WebSocket from 'ws'
8
7
  import { createClient } from 'graphql-ws'
9
8
  import { GraphQLWsLink } from '@apollo/client/link/subscriptions'
@@ -20,7 +19,7 @@ import { ScenarioInstance } from '../../service/scenario-instance/scenario-insta
20
19
  import { getRepository, GraphqlLocalClient, Domain } from '@things-factory/shell'
21
20
  import { User, checkPermission } from '@things-factory/auth-base'
22
21
 
23
- const debug = require('debug')('things-factory:integration-base:operato-connector-subscription')
22
+ const debug = require('debug')('things-factory:integration-base:operato-connector')
24
23
 
25
24
  const defaultOptions: any = {
26
25
  watchQuery: {
@@ -36,10 +35,6 @@ const defaultOptions: any = {
36
35
  }
37
36
  }
38
37
 
39
- const cache = new InMemoryCache({
40
- addTypename: false
41
- })
42
-
43
38
  export const GRAPHQL_URI = '/graphql'
44
39
  export const SUBSCRIPTION_URI = GRAPHQL_URI
45
40
 
@@ -48,7 +43,6 @@ interface SubscriberData {
48
43
  scenario: any
49
44
  subscriptionObserver: any
50
45
  }
51
- ;``
52
46
 
53
47
  export class OperatoConnector implements Connector {
54
48
  private context: any
@@ -56,11 +50,11 @@ export class OperatoConnector implements Connector {
56
50
  async ready(connectionConfigs: InputConnection[]) {
57
51
  await Promise.all(connectionConfigs.map(this.connect.bind(this)))
58
52
 
59
- ConnectionManager.logger.info('graphql-connector connections are ready')
53
+ ConnectionManager.logger.info('operato-connector connections are ready')
60
54
  }
61
55
 
62
56
  async connect(connection: InputConnection) {
63
- var {
57
+ const {
64
58
  endpoint: uri,
65
59
  params: { authKey, domain, subscriptionHandlers = {} }
66
60
  } = connection
@@ -69,7 +63,7 @@ export class OperatoConnector implements Connector {
69
63
  throw new Error('some connection paramter missing.')
70
64
  }
71
65
 
72
- var domainOwner = await getRepository(User).findOne({
66
+ const domainOwner = await getRepository(User).findOne({
73
67
  where: {
74
68
  id: connection.domain.owner
75
69
  }
@@ -125,20 +119,24 @@ export class OperatoConnector implements Connector {
125
119
  }).concat(httpLink)
126
120
  )
127
121
 
128
- var client = new ApolloClient({
122
+ const cache = new InMemoryCache({
123
+ addTypename: false
124
+ })
125
+
126
+ const client = new ApolloClient({
129
127
  defaultOptions,
130
128
  cache,
131
129
  link: splitLink
132
130
  })
133
131
 
134
- var subscriptions: SubscriberData[] = []
132
+ const subscriptions: SubscriberData[] = []
135
133
  Object.keys(subscriptionHandlers).forEach(async tag => {
136
134
  if (!tag || !subscriptionHandlers[tag]) return
137
135
 
138
- let scenarioName = subscriptionHandlers[tag]
136
+ const scenarioName = subscriptionHandlers[tag]
139
137
 
140
138
  // fetch a scenario
141
- var selectedScenario = await getRepository(Scenario).findOne({
139
+ const selectedScenario = await getRepository(Scenario).findOne({
142
140
  where: {
143
141
  name: scenarioName
144
142
  },
@@ -156,7 +154,7 @@ export class OperatoConnector implements Connector {
156
154
  `
157
155
  })
158
156
 
159
- var subscriptionObserver = subscription.subscribe({
157
+ const subscriptionObserver = subscription.subscribe({
160
158
  next: async data => {
161
159
  debug('received pubsub msg.:', data?.data)
162
160
  await this.runScenario(subscriptions, data?.data?.data)
@@ -169,9 +167,7 @@ export class OperatoConnector implements Connector {
169
167
  }
170
168
  })
171
169
 
172
- ConnectionManager.logger.info(
173
- `(${connection.name}:${connection.endpoint}) subscription closed flag: ${subscriptionObserver.closed}`
174
- )
170
+ ConnectionManager.logger.info(`(${connection.name}:${connection.endpoint}) subscription closed flag: ${subscriptionObserver.closed}`)
175
171
 
176
172
  subscriptions.push({
177
173
  tag,
@@ -184,19 +180,17 @@ export class OperatoConnector implements Connector {
184
180
  client['subscriptions'] = subscriptions
185
181
  ConnectionManager.addConnectionInstance(connection, client)
186
182
 
187
- ConnectionManager.logger.info(
188
- `graphql-connector connection(${connection.name}:${connection.endpoint}) is connected`
189
- )
183
+ ConnectionManager.logger.info(`operato-connector connection(${connection.name}:${connection.endpoint}) is connected`)
190
184
  }
191
185
 
192
186
  async disconnect(connection: InputConnection) {
193
- var client = ConnectionManager.getConnectionInstance(connection)
194
- let subscriptions: SubscriberData[] = client['subscriptions']
187
+ const client = ConnectionManager.getConnectionInstance(connection)
188
+ const subscriptions: SubscriberData[] = client['subscriptions']
195
189
  subscriptions.forEach(subscription => subscription.subscriptionObserver.unsubscribe())
196
190
  client.stop()
197
191
  ConnectionManager.removeConnectionInstance(connection)
198
192
 
199
- ConnectionManager.logger.info(`graphql-connector connection(${connection.name}) is disconnected`)
193
+ ConnectionManager.logger.info(`operato-connector connection(${connection.name}) is disconnected`)
200
194
  }
201
195
 
202
196
  async runScenario(subscriptions: SubscriberData[], variables: any): Promise<ScenarioInstance> {
@@ -207,23 +201,19 @@ export class OperatoConnector implements Connector {
207
201
  throw new Error(`tag is invalid - ${tag}`)
208
202
  }
209
203
 
210
- var scenario = subscriptions.find(subscription => subscription.tag === tag)?.scenario
204
+ const scenario = subscriptions.find(subscription => subscription.tag === tag)?.scenario
211
205
  if (!scenario) {
212
206
  throw new Error(`scenario is not found - ${tag}`)
213
207
  }
214
208
 
215
209
  if (!(await checkPermission(scenario.privilege, user, domain, unsafeIP, prohibitedPrivileges))) {
216
210
  const { category, privilege } = scenario.privilege || {}
217
- throw new Error(
218
- `Unauthorized! ${
219
- category && privilege ? category + ':' + privilege + ' privilege' : 'ownership granted'
220
- } required`
221
- )
211
+ throw new Error(`Unauthorized! ${category && privilege ? category + ':' + privilege + ' privilege' : 'ownership granted'} required`)
222
212
  }
223
213
 
224
214
  /* create a scenario instance */
225
- let instanceName = scenario.name + '-' + String(Date.now())
226
- var instance = new ScenarioInstance(instanceName, scenario, {
215
+ const instanceName = scenario.name + '-' + String(Date.now())
216
+ const instance = new ScenarioInstance(instanceName, scenario, {
227
217
  user,
228
218
  domain,
229
219
  variables,
@@ -4,9 +4,8 @@ import { ConnectionManager } from '../connection-manager'
4
4
  import { Connector } from '../types'
5
5
  import { InputConnection } from '../../service/connection/connection-type'
6
6
 
7
-
8
7
  try {
9
- var Client = require('oracledb')
8
+ var oracledb = require('oracledb')
10
9
  } catch (err) {
11
10
  logger.error('oracledb module loading failed')
12
11
  }
@@ -18,42 +17,132 @@ export class OracleConnector implements Connector {
18
17
  ConnectionManager.logger.info('oracle-connector connections are ready')
19
18
  }
20
19
 
21
- async connect(connection: InputConnection) {
20
+ async recreatePool(connection: InputConnection) {
22
21
  const {
22
+ name,
23
23
  endpoint,
24
- params: { user, password, database }
24
+ params: { user, password, database, poolMin, poolMax, poolIncrement },
25
+ domain
25
26
  } = connection
26
27
 
27
- if (!Client) {
28
+ if (!oracledb) {
28
29
  throw new Error('oracledb module loading failed')
29
30
  }
30
31
 
31
- //when oracle not using default port must add connection string with port like localhsot:port
32
- const client = await Client.getConnection({
32
+ const poolAlias = `${domain.name}-${name}`
33
+ await oracledb.getPool(poolAlias).close(10)
34
+ await oracledb.createPool({
33
35
  user,
34
36
  password,
35
- connectString: `${endpoint.trim()}/${database}`
37
+ // when oracle not using default port must add connection string with port like localhost:port
38
+ connectString: `${endpoint.trim()}/${database}`,
39
+ poolMin,
40
+ poolMax,
41
+ poolIncrement,
42
+ poolAlias
36
43
  })
37
44
 
45
+ ConnectionManager.logger.info(`Oracle Database(${connection.name}:${database}) at ${endpoint} recreated.`)
46
+ }
47
+
48
+ async connect(connection: InputConnection) {
49
+ const {
50
+ name,
51
+ endpoint,
52
+ params: { user, password, database, poolMin, poolMax, poolIncrement },
53
+ domain
54
+ } = connection
55
+
56
+ if (!oracledb) {
57
+ throw new Error('oracledb module loading failed')
58
+ }
59
+
60
+ const poolAlias = `${domain.name}-${name}`
61
+
62
+ var enableStatistics = true
63
+ const pool = await oracledb.createPool({
64
+ user,
65
+ password,
66
+ // when oracle not using default port must add connection string with port like localhost:port
67
+ connectString: `${endpoint.trim()}/${database}`,
68
+ poolMin,
69
+ poolMax,
70
+ poolIncrement,
71
+ poolAlias,
72
+ enableStatistics
73
+ })
74
+
38
75
  ConnectionManager.addConnectionInstance(connection, {
39
76
  query: async (query, params) => {
40
- return (
41
- await client.execute(query, params, {
42
- outFormat: Client.OBJECT
43
- })
44
- ).rows
77
+ let dbConnection: any = {}
78
+ let taskResult: any = {}
79
+ try {
80
+ dbConnection = await oracledb.getConnection(poolAlias)
81
+
82
+ taskResult = (
83
+ await dbConnection.execute(query, params, {
84
+ outFormat: oracledb.OBJECT
85
+ })
86
+ ).rows
87
+ } catch (e) {
88
+ if (e.name === 'Error' && e.message.includes('NJS-040')) {
89
+ await this.recreatePool(connection)
90
+ }
91
+ throw e
92
+ }
93
+ finally {
94
+ await dbConnection.close()
95
+ }
96
+ return taskResult
97
+
45
98
  },
46
99
  execute: async (procedure, params) => {
47
- // TODO: need to check if this is available when procedure string is a common query.
48
- procedure = `BEGIN
49
- ${procedure}
50
- END;`
51
-
52
- return await client.execute(procedure, params, {
53
- outFormat: Client.OBJECT
54
- })
100
+ let dbConnection: any = {}
101
+ let taskResult: any = {}
102
+ try {
103
+ // TODO: need to check if this is available when procedure string is a common query.
104
+ procedure = `BEGIN
105
+ ${procedure}
106
+ END;`
107
+ dbConnection = await oracledb.getConnection(poolAlias)
108
+
109
+ // console.log('\n************* stat after get ****************')
110
+ // await oracledb.getPool(poolAlias).logStatistics()
111
+
112
+ const result = await dbConnection.execute(procedure, params, {
113
+ outFormat: oracledb.OBJECT
114
+ })
115
+
116
+ let paramKeys = Object.keys(params)
117
+
118
+ for (const paramKey of paramKeys) {
119
+ if (params[paramKey].dir === oracledb?.BIND_OUT) {
120
+ if (params[paramKey].type === oracledb?.CURSOR) {
121
+ const resultSetTemp = result.outBinds[paramKey]
122
+ taskResult[paramKey] = await resultSetTemp.getRows()
123
+ await resultSetTemp.close()
124
+ } else {
125
+ taskResult[paramKey] = result.outBinds[paramKey]
126
+ }
127
+ }
128
+ }
129
+ } catch (e) {
130
+ if (e.name === 'Error' && e.message.includes('NJS-040')) {
131
+ await this.recreatePool(connection)
132
+ }
133
+ throw e
134
+ }
135
+ finally {
136
+ await dbConnection.close()
137
+
138
+ // console.log('\n************* stat after close ****************')
139
+ // await oracledb.getPool(poolAlias).logStatistics()
140
+ }
141
+ return taskResult
55
142
  },
56
- close: client.close.bind(client)
143
+ close: async () => {
144
+ await oracledb.getPool(poolAlias).close(10)
145
+ }
57
146
  })
58
147
 
59
148
  ConnectionManager.logger.info(`Oracle Database(${connection.name}:${database}) at ${endpoint} connected.`)
@@ -89,6 +178,27 @@ export class OracleConnector implements Connector {
89
178
  name: 'database',
90
179
  placeholder: 'SID',
91
180
  label: 'database'
181
+ },
182
+ {
183
+ type: 'number',
184
+ name: 'poolMin',
185
+ placeholder: 'minimum connection-pool size',
186
+ label: 'pool-min',
187
+ value: 0
188
+ },
189
+ {
190
+ type: 'number',
191
+ name: 'poolMax',
192
+ placeholder: 'maximum connection-pool size',
193
+ label: 'pool-max',
194
+ value: 4
195
+ },
196
+ {
197
+ type: 'number',
198
+ name: 'poolIncrement',
199
+ placeholder: 'connection incremental size',
200
+ label: 'pool-increment',
201
+ value: 1
92
202
  }
93
203
  ]
94
204
  }
@@ -0,0 +1,53 @@
1
+ import { ConnectionManager } from '../connection-manager'
2
+ import { Connector } from '../types'
3
+ import { InputConnection } from '../../service/connection/connection-type'
4
+ import { connectConnections, disconnectConnections } from '../edge-client'
5
+
6
+ /**
7
+ * This connector is a proxy connector installed on the edge server to manage connections from the host.
8
+ * It interacts with connections established on the edge server and provides synchronization functionality.
9
+ */
10
+ export class ProxyConnector implements Connector {
11
+ public static instance = new ProxyConnector()
12
+
13
+ async ready(connectionConfigs: InputConnection[]) {
14
+ await Promise.all(connectionConfigs.map(this.connect.bind(this)))
15
+
16
+ ConnectionManager.logger.info('proxy-connector connections are ready')
17
+ }
18
+
19
+ async connect(connection: InputConnection) {
20
+ // TODO 원래 커넥션과 에지설정을 참고하여, 에지 서버로 CONNECT/DISCONNECT 명령을 보낸다.
21
+ const proxy = {
22
+ disconnect: async () => {
23
+ ConnectionManager.logger.info('[proxy-connector] trying disconnect')
24
+ await disconnectConnections([connection])
25
+ }
26
+ }
27
+
28
+ await connectConnections([connection])
29
+
30
+ ConnectionManager.addConnectionInstance(connection, proxy)
31
+
32
+ ConnectionManager.logger.info(`proxy-connector connection(${connection.name}:${connection.endpoint}) is connected`)
33
+ }
34
+
35
+ async disconnect(connection: InputConnection) {
36
+ const proxy = ConnectionManager.removeConnectionInstance(connection)
37
+ await proxy.disconnect()
38
+
39
+ ConnectionManager.logger.info(`proxy-connector connection(${connection.name}) is disconnected`)
40
+ }
41
+
42
+ get parameterSpec() {
43
+ return []
44
+ }
45
+
46
+ get taskPrefixes() {
47
+ return []
48
+ }
49
+
50
+ get description() {
51
+ return 'Operato Proxy Connector'
52
+ }
53
+ }
@@ -0,0 +1,45 @@
1
+ import { Connection } from '../service/connection/connection-type'
2
+ import { Step } from '../service/step/step-type'
3
+ import { Context, TaskHandler } from './types'
4
+
5
+ export type EdgeClient = {
6
+ handler: TaskHandler
7
+ syncConnections(connections: Connection[], context?: ResolverContext): Promise<any>
8
+ connectConnections(connections: Connection[], context?: ResolverContext): Promise<any>
9
+ disconnectConnections(connections: Connection[], context?: ResolverContext): Promise<any>
10
+ }
11
+
12
+ var edgeClient: EdgeClient = {
13
+ async handler(step: Step, scenarioContext: Context) {
14
+ throw 'edgeClient not supported'
15
+ },
16
+ async syncConnections(connections: Connection[], context: ResolverContext): Promise<any> {
17
+ throw 'edgeClient not supported'
18
+ },
19
+ async connectConnections(connections: Connection[], context: ResolverContext): Promise<any> {
20
+ throw 'edgeClient not supported'
21
+ },
22
+ async disconnectConnections(connections: Connection[], context: ResolverContext): Promise<any> {
23
+ throw 'edgeClient not supported'
24
+ }
25
+ }
26
+
27
+ export async function handler(step: Step, scenarioContext: Context) {
28
+ return await edgeClient.handler(step, scenarioContext)
29
+ }
30
+
31
+ export async function syncConnections(connections: Connection[], context?: ResolverContext): Promise<any> {
32
+ return await edgeClient.syncConnections(connections, context)
33
+ }
34
+
35
+ export async function connectConnections(connections: Connection[], context?: ResolverContext): Promise<any> {
36
+ return await edgeClient.connectConnections(connections, context)
37
+ }
38
+
39
+ export async function disconnectConnections(connections: Connection[], context?: ResolverContext): Promise<any> {
40
+ return await edgeClient.disconnectConnections(connections, context)
41
+ }
42
+
43
+ export function setEdgeClient(edge: EdgeClient) {
44
+ edgeClient = edge
45
+ }
@@ -5,5 +5,6 @@ export * from './connection-manager'
5
5
  export * from './scenario-engine'
6
6
  export * from './task-registry'
7
7
  export * from './analyzer/analyze-integration'
8
+ export * from './edge-client'
8
9
 
9
10
  export { Connector } from './types'
@@ -97,23 +97,8 @@ async function OracleProcedure(step: InputStep, context: Context) {
97
97
 
98
98
  const result = await dbconnection.execute(code, procedureParameters)
99
99
 
100
- var taskResult = {}
101
- let paramKeys = Object.keys(procedureParameters)
102
-
103
- for (const paramKey of paramKeys) {
104
- if (procedureParameters[paramKey].dir === oracledb?.BIND_OUT) {
105
- if (procedureParameters[paramKey].type === oracledb?.CURSOR) {
106
- const resultSetTemp = result.outBinds[paramKey]
107
- taskResult[paramKey] = await resultSetTemp.getRows()
108
- await resultSetTemp.close()
109
- } else {
110
- taskResult[paramKey] = result.outBinds[paramKey]
111
- }
112
- }
113
- }
114
-
115
100
  return {
116
- data: taskResult
101
+ data: result
117
102
  }
118
103
  }
119
104
 
@@ -19,6 +19,7 @@ async function Script(step: InputStep, context: Context) {
19
19
  domain,
20
20
  user,
21
21
  lng,
22
+ logger,
22
23
  data,
23
24
  variables
24
25
  }
@@ -55,7 +55,7 @@ async function initializeChromium() {
55
55
 
56
56
  var launchSetting = {
57
57
  args: ['--mute-audio', '--no-sandbox'],
58
- headless: 'new'
58
+ headless: 'shell'
59
59
  }
60
60
 
61
61
  if (CHROMIUM_PATH) {
@@ -13,79 +13,79 @@ export interface Connector {
13
13
  }
14
14
 
15
15
  export type Context = {
16
- /**
17
- * Represents the domain context.
18
- */
16
+ /**
17
+ * Represents the domain context.
18
+ */
19
19
  domain: Domain
20
20
 
21
- /**
22
- * User information.
23
- */
21
+ /**
22
+ * User information.
23
+ */
24
24
  user: User
25
25
 
26
- /**
27
- * Language code, for example 'en', 'ko'.
28
- */
26
+ /**
27
+ * Language code, for example 'en', 'ko'.
28
+ */
29
29
  lng: string
30
30
 
31
- /**
32
- * Flag to indicate if the IP is unsafe, can be undefined.
33
- */
31
+ /**
32
+ * Flag to indicate if the IP is unsafe, can be undefined.
33
+ */
34
34
  unsafeIP: boolean | undefined
35
35
 
36
- /**
37
- * List of prohibited privileges, can be undefined.
38
- */
36
+ /**
37
+ * List of prohibited privileges, can be undefined.
38
+ */
39
39
  prohibitedPrivileges: { category: string; privilege: string }[] | undefined
40
40
 
41
- /**
42
- * Logger for logging purposes.
43
- */
41
+ /**
42
+ * Logger for logging purposes.
43
+ */
44
44
  logger: any
45
45
 
46
- /**
47
- * Function to publish events or messages.
48
- */
46
+ /**
47
+ * Function to publish events or messages.
48
+ */
49
49
  publish: Function
50
50
 
51
- /**
52
- * Function to load resources or data.
53
- */
51
+ /**
52
+ * Function to load resources or data.
53
+ */
54
54
  load: Function
55
55
 
56
- /**
57
- * Current status of the scenario instance.
58
- */
56
+ /**
57
+ * Current status of the scenario instance.
58
+ */
59
59
  state: ScenarioInstanceStatus
60
60
 
61
- /**
62
- * General data storage object.
63
- */
61
+ /**
62
+ * General data storage object.
63
+ */
64
64
  data: any
65
65
 
66
- /**
67
- * Variables related to the context.
68
- */
66
+ /**
67
+ * Variables related to the context.
68
+ */
69
69
  variables: Object
70
70
 
71
- /**
72
- * Local GraphQL client object.
73
- */
71
+ /**
72
+ * Local GraphQL client object.
73
+ */
74
74
  client: any /* graphql local client */
75
75
 
76
- /**
77
- * Root object, can be used for various purposes.
78
- */
76
+ /**
77
+ * Root object, can be used for various purposes.
78
+ */
79
79
  root: Object
80
80
 
81
- /**
82
- * Array of function closures.
83
- */
81
+ /**
82
+ * Array of function closures.
83
+ */
84
84
  closures: Function[]
85
85
 
86
- /**
87
- * Function to check the state.
88
- */
86
+ /**
87
+ * Function to check the state.
88
+ */
89
89
  checkState: Function
90
90
 
91
91
  /**
@@ -104,7 +104,6 @@ export type Context = {
104
104
  __csv_resources?: any
105
105
  }
106
106
 
107
-
108
107
  export type TaskHandler = (
109
108
  step: Step,
110
109
  context: Context