@things-factory/integration-base 7.0.1-alpha.10 → 7.0.1-alpha.102
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/controllers/scenario-controller.js +13 -2
- package/dist-server/controllers/scenario-controller.js.map +1 -1
- package/dist-server/engine/task/database-query.js +5 -1
- package/dist-server/engine/task/database-query.js.map +1 -1
- package/dist-server/engine/task/graphql-mutate.js +7 -1
- package/dist-server/engine/task/graphql-mutate.js.map +1 -1
- package/dist-server/engine/task/graphql-query.js +7 -1
- package/dist-server/engine/task/graphql-query.js.map +1 -1
- package/dist-server/engine/task/jsonata.js +5 -1
- package/dist-server/engine/task/jsonata.js.map +1 -1
- package/dist-server/engine/task/local-graphql-mutate.js +7 -1
- package/dist-server/engine/task/local-graphql-mutate.js.map +1 -1
- package/dist-server/engine/task/local-graphql-query.js +7 -1
- package/dist-server/engine/task/local-graphql-query.js.map +1 -1
- package/dist-server/engine/task/script.js +5 -1
- package/dist-server/engine/task/script.js.map +1 -1
- package/dist-server/service/connection/connection-type.js +2 -2
- package/dist-server/service/connection/connection-type.js.map +1 -1
- package/dist-server/service/payload-log/payload-log.js +1 -1
- package/dist-server/service/payload-log/payload-log.js.map +1 -1
- package/dist-server/service/property-spec.js +4 -0
- package/dist-server/service/property-spec.js.map +1 -1
- package/dist-server/service/scenario/scenario.js +1 -1
- package/dist-server/service/scenario/scenario.js.map +1 -1
- package/dist-server/service/state-register/state-register.js +1 -1
- package/dist-server/service/state-register/state-register.js.map +1 -1
- package/dist-server/service/step/step-type.js +17 -14
- 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/controllers/scenario-controller.ts +15 -2
- package/server/engine/task/database-query.ts +5 -1
- package/server/engine/task/graphql-mutate.ts +7 -1
- package/server/engine/task/graphql-query.ts +7 -1
- package/server/engine/task/jsonata.ts +5 -1
- package/server/engine/task/local-graphql-mutate.ts +7 -3
- package/server/engine/task/local-graphql-query.ts +7 -1
- package/server/engine/task/script.ts +5 -1
- package/server/service/connection/connection-type.ts +12 -3
- package/server/service/payload-log/payload-log.ts +3 -3
- package/server/service/property-spec.ts +3 -0
- package/server/service/scenario/scenario.ts +1 -1
- package/server/service/state-register/state-register.ts +1 -1
- package/server/service/step/step-type.ts +59 -57
- package/translations/en.json +2 -0
- package/translations/ja.json +2 -0
- package/translations/ko.json +2 -0
- package/translations/ms.json +2 -0
- package/translations/zh.json +2 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-base",
|
3
|
-
"version": "7.0.1-alpha.
|
3
|
+
"version": "7.0.1-alpha.102",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -26,22 +26,22 @@
|
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
28
|
"@apollo/client": "^3.6.9",
|
29
|
-
"@
|
30
|
-
"@things-factory/
|
31
|
-
"@things-factory/
|
32
|
-
"@things-factory/
|
33
|
-
"@things-factory/
|
34
|
-
"@things-factory/
|
35
|
-
"@things-factory/
|
29
|
+
"@operato/moment-timezone-es": "^2.0.0-alpha.0",
|
30
|
+
"@things-factory/api": "^7.0.1-alpha.102",
|
31
|
+
"@things-factory/auth-base": "^7.0.1-alpha.102",
|
32
|
+
"@things-factory/env": "^7.0.1-alpha.71",
|
33
|
+
"@things-factory/oauth2-client": "^7.0.1-alpha.102",
|
34
|
+
"@things-factory/scheduler-client": "^7.0.1-alpha.102",
|
35
|
+
"@things-factory/shell": "^7.0.1-alpha.102",
|
36
|
+
"@things-factory/utils": "^7.0.1-alpha.71",
|
36
37
|
"async-mqtt": "^2.5.0",
|
37
38
|
"chance": "^1.1.11",
|
38
39
|
"cross-fetch": "^3.0.4",
|
39
40
|
"ieee754": "^1.2.1",
|
40
|
-
"moment-timezone": "^0.5.40",
|
41
41
|
"node-fetch": "^2.6.0",
|
42
42
|
"promise-socket": "^7.0.0",
|
43
43
|
"readline": "^1.3.0",
|
44
44
|
"vm2": "^3.9.11"
|
45
45
|
},
|
46
|
-
"gitHead": "
|
46
|
+
"gitHead": "2bce598261c2d7377ea008ee687358480a2869bc"
|
47
47
|
}
|
@@ -43,7 +43,12 @@ export async function runScenario(instanceName: string, scenarioName: string, va
|
|
43
43
|
|
44
44
|
if (!(await checkPermission(scenario.privilege, user, domain, unsafeIP, prohibitedPrivileges))) {
|
45
45
|
const { category, privilege } = scenario.privilege || {}
|
46
|
-
|
46
|
+
|
47
|
+
console.error(`Unauthorized! ${category && privilege ? category + ':' + privilege + ' privilege' : 'ownership granted'} required`)
|
48
|
+
|
49
|
+
throw new Error(context.t('error.scenario run unauthorized', {
|
50
|
+
scenario: scenarioName
|
51
|
+
}))
|
47
52
|
}
|
48
53
|
|
49
54
|
/* 시나리오 인스턴스를 생성한다. */
|
@@ -56,7 +61,15 @@ export async function runScenario(instanceName: string, scenarioName: string, va
|
|
56
61
|
client: GraphqlLocalClient.client
|
57
62
|
})
|
58
63
|
|
59
|
-
|
64
|
+
try {
|
65
|
+
await instance.run()
|
66
|
+
} catch(err) {
|
67
|
+
console.error(err)
|
68
|
+
|
69
|
+
throw new Error(context.t('error.scenario run error', {
|
70
|
+
scenario: scenarioName
|
71
|
+
}))
|
72
|
+
}
|
60
73
|
|
61
74
|
return instance
|
62
75
|
}
|
@@ -9,8 +9,6 @@ import { TaskRegistry } from '../task-registry'
|
|
9
9
|
import { InputStep } from '../../service/step/step-type'
|
10
10
|
import { Context } from '../types'
|
11
11
|
|
12
|
-
|
13
|
-
|
14
12
|
async function LocalGraphqlMutate(step: InputStep, context: Context) {
|
15
13
|
var { params, updaterId } = step
|
16
14
|
var { mutation, variables: variablesAccessorMap, headers } = params || {}
|
@@ -70,7 +68,13 @@ LocalGraphqlMutate.parameterSpec = [
|
|
70
68
|
{
|
71
69
|
type: 'graphql',
|
72
70
|
name: 'mutation',
|
73
|
-
label: 'mutation'
|
71
|
+
label: 'mutation',
|
72
|
+
property: {
|
73
|
+
showLineNumbers: true
|
74
|
+
},
|
75
|
+
styles: {
|
76
|
+
flex: 1
|
77
|
+
}
|
74
78
|
},
|
75
79
|
{
|
76
80
|
type: 'key-values',
|
@@ -1,5 +1,14 @@
|
|
1
1
|
import { Field, ID, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
Column,
|
4
|
+
CreateDateColumn,
|
5
|
+
Entity,
|
6
|
+
Index,
|
7
|
+
ManyToOne,
|
8
|
+
PrimaryGeneratedColumn,
|
9
|
+
RelationId,
|
10
|
+
UpdateDateColumn
|
11
|
+
} from 'typeorm'
|
3
12
|
|
4
13
|
import { User, Appliance } from '@things-factory/auth-base'
|
5
14
|
import { logger } from '@things-factory/env'
|
@@ -33,7 +42,7 @@ export class Connection {
|
|
33
42
|
* Many-to-One relationship with the Domain entity.
|
34
43
|
*/
|
35
44
|
@ManyToOne(type => Domain)
|
36
|
-
@Field({ nullable: true })
|
45
|
+
@Field(type => Domain, { nullable: true })
|
37
46
|
domain: Domain
|
38
47
|
|
39
48
|
/**
|
@@ -193,7 +202,7 @@ export interface InputConnection extends Connection {
|
|
193
202
|
|
194
203
|
@ObjectType()
|
195
204
|
export class ConnectionState {
|
196
|
-
@Field(
|
205
|
+
@Field(type => Domain)
|
197
206
|
domain?: Domain
|
198
207
|
|
199
208
|
@Field({ nullable: true })
|
@@ -32,7 +32,7 @@ export class PayloadLog {
|
|
32
32
|
readonly id: string
|
33
33
|
|
34
34
|
@ManyToOne(type => Domain)
|
35
|
-
@Field(
|
35
|
+
@Field(type => Domain)
|
36
36
|
domain?: Domain
|
37
37
|
|
38
38
|
@RelationId((payloadLog: PayloadLog) => payloadLog.domain)
|
@@ -47,8 +47,8 @@ export class PayloadLog {
|
|
47
47
|
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
48
48
|
? 'enum'
|
49
49
|
: DATABASE_TYPE == 'oracle'
|
50
|
-
|
51
|
-
|
50
|
+
? 'varchar2'
|
51
|
+
: 'smallint',
|
52
52
|
enum: PayloadType,
|
53
53
|
default: PayloadType.EGESTION,
|
54
54
|
nullable: true
|
@@ -15,110 +15,112 @@ import { Domain } from '@things-factory/shell'
|
|
15
15
|
|
16
16
|
import { Scenario } from '../scenario/scenario'
|
17
17
|
|
18
|
-
|
19
18
|
@Entity()
|
20
19
|
@Index('ix_step_0', (step: Step) => [step.scenario, step.sequence], { unique: true })
|
21
20
|
@ObjectType()
|
22
21
|
export class Step {
|
23
|
-
/**
|
24
|
-
|
25
|
-
|
22
|
+
/**
|
23
|
+
* The unique identifier for each step.
|
24
|
+
*/
|
26
25
|
@PrimaryGeneratedColumn('uuid')
|
27
26
|
@Field(type => ID)
|
28
27
|
readonly id: string
|
29
28
|
|
30
|
-
/**
|
31
|
-
|
32
|
-
|
29
|
+
/**
|
30
|
+
* The domain to which this step belongs.
|
31
|
+
*/
|
33
32
|
@ManyToOne(type => Domain)
|
34
|
-
@Field({ nullable: true })
|
33
|
+
@Field(type => Domain, { nullable: true })
|
35
34
|
domain: Domain
|
36
35
|
|
37
|
-
/**
|
38
|
-
|
39
|
-
|
36
|
+
/**
|
37
|
+
* The ID of the domain associated with this step.
|
38
|
+
*/
|
40
39
|
@RelationId((step: Step) => step.domain)
|
41
40
|
domainId: string
|
42
41
|
|
43
|
-
/**
|
44
|
-
|
45
|
-
|
42
|
+
/**
|
43
|
+
* The name of the step.
|
44
|
+
*/
|
46
45
|
@Column({ nullable: true })
|
47
46
|
@Field()
|
48
47
|
name: string
|
49
48
|
|
50
|
-
/**
|
51
|
-
|
52
|
-
|
49
|
+
/**
|
50
|
+
* A description of what the step involves.
|
51
|
+
*/
|
53
52
|
@Column({ nullable: true })
|
54
53
|
@Field({ nullable: true })
|
55
54
|
description: string
|
56
55
|
|
57
|
-
/**
|
58
|
-
|
59
|
-
|
56
|
+
/**
|
57
|
+
* The scenario that includes this step.
|
58
|
+
*/
|
60
59
|
@ManyToOne(type => Scenario, scenario => scenario.steps, { onDelete: 'CASCADE' })
|
61
60
|
@Field(type => Scenario, { nullable: true })
|
62
61
|
scenario: Scenario
|
63
62
|
|
64
|
-
/**
|
65
|
-
|
66
|
-
|
63
|
+
/**
|
64
|
+
* The ID of the scenario associated with this step.
|
65
|
+
*/
|
67
66
|
@RelationId((step: Step) => step.scenario)
|
68
67
|
scenarioId: string
|
69
68
|
|
70
|
-
/**
|
71
|
-
|
72
|
-
|
69
|
+
/**
|
70
|
+
* The sequence number of the step within its scenario.
|
71
|
+
*/
|
73
72
|
@Column()
|
74
73
|
@Field({ nullable: true })
|
75
74
|
sequence: number
|
76
75
|
|
77
|
-
/**
|
78
|
-
|
79
|
-
|
76
|
+
/**
|
77
|
+
* The specific task associated with this step.
|
78
|
+
*/
|
80
79
|
@Column()
|
81
80
|
@Field({ nullable: true })
|
82
81
|
task: string
|
83
82
|
|
84
|
-
/**
|
85
|
-
|
86
|
-
|
83
|
+
/**
|
84
|
+
* Boolean value to indicate if the step should be skipped.
|
85
|
+
*/
|
87
86
|
@Column({ nullable: true })
|
88
87
|
@Field({ nullable: true })
|
89
88
|
skip: boolean
|
90
89
|
|
91
|
-
/**
|
92
|
-
|
93
|
-
|
90
|
+
/**
|
91
|
+
* Boolean value to indicate if the step should be logged.
|
92
|
+
*/
|
94
93
|
@Column({ nullable: true })
|
95
94
|
@Field({ nullable: true })
|
96
95
|
log: boolean
|
97
96
|
|
98
|
-
/**
|
99
|
-
|
100
|
-
|
97
|
+
/**
|
98
|
+
* The connection details associated with this step.
|
99
|
+
*/
|
101
100
|
@Column({ nullable: true })
|
102
101
|
@Field({ nullable: true })
|
103
102
|
connection: string
|
104
103
|
|
105
|
-
/**
|
106
|
-
|
107
|
-
|
104
|
+
/**
|
105
|
+
* The parameters for the step.
|
106
|
+
*/
|
108
107
|
@Column({ nullable: true })
|
109
108
|
@Field({ nullable: true })
|
110
109
|
params: string
|
111
110
|
|
112
|
-
/**
|
113
|
-
|
114
|
-
|
111
|
+
/**
|
112
|
+
* A boolean attribute indicating the inclusion status of an element in the result.
|
113
|
+
*/
|
115
114
|
@Column({ nullable: true, default: true })
|
116
|
-
@Field({
|
115
|
+
@Field({
|
116
|
+
nullable: true,
|
117
|
+
description: 'A boolean attribute indicating the inclusion status of an element in the result'
|
118
|
+
})
|
117
119
|
result: boolean = true
|
118
120
|
|
119
|
-
/**
|
120
|
-
|
121
|
-
|
121
|
+
/**
|
122
|
+
* The timestamp when the step was created.
|
123
|
+
*/
|
122
124
|
@CreateDateColumn()
|
123
125
|
@Field({ nullable: true })
|
124
126
|
createdAt: Date
|
@@ -132,28 +134,28 @@ export class Step {
|
|
132
134
|
updatedAt: Date
|
133
135
|
|
134
136
|
/**
|
135
|
-
|
136
|
-
|
137
|
+
* The user who created this step.
|
138
|
+
*/
|
137
139
|
@ManyToOne(type => User, { nullable: true })
|
138
140
|
@Field({ nullable: true })
|
139
141
|
creator: User
|
140
142
|
|
141
143
|
/**
|
142
|
-
|
143
|
-
|
144
|
+
* The ID of the user who created this step.
|
145
|
+
*/
|
144
146
|
@RelationId((step: Step) => step.creator)
|
145
147
|
creatorId: string
|
146
148
|
|
147
149
|
/**
|
148
|
-
|
149
|
-
|
150
|
+
* The user who last updated this step.
|
151
|
+
*/
|
150
152
|
@ManyToOne(type => User, { nullable: true })
|
151
153
|
@Field({ nullable: true })
|
152
154
|
updater: User
|
153
155
|
|
154
156
|
/**
|
155
|
-
|
156
|
-
|
157
|
+
* The ID of the user who last updated this step.
|
158
|
+
*/
|
157
159
|
@RelationId((step: Step) => step.updater)
|
158
160
|
updaterId: string
|
159
161
|
}
|
@@ -197,7 +199,7 @@ export class StepPatch {
|
|
197
199
|
/**
|
198
200
|
* Step의 params의 원 타입과 사용 시에 타입 불일치로 인해 임시적으로 생성한 타입으로
|
199
201
|
* 추후, 타입 일치를 통해서 제거할 예정임.
|
200
|
-
*
|
202
|
+
*
|
201
203
|
*/
|
202
204
|
export interface InputStep extends Step {
|
203
205
|
params: any
|
package/translations/en.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"error.scenario not found": "scenario '{scenario}' not found.",
|
3
|
+
"error.scenario run error": "an error occurred while processing the '{scenario}' request. please contact the administrator.",
|
4
|
+
"error.scenario run unauthorized": "you do not have permission to run the {scenario} scenario. please contact the administrator.",
|
3
5
|
"error.schedule is not set": "schedule should be set for the scenario '{scenario}' in order to register as a schedule",
|
4
6
|
"error.timezone is not set": "timezone should be set for the scenario '{scenario}' in order to register as a schedule",
|
5
7
|
"error.scenario instance not found": "scenario instance '{instance}' not found.",
|
package/translations/ja.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"error.scenario not found": "シナリオ'{scenario}'が見つかりません.",
|
3
|
+
"error.scenario run error": "シナリオ '{scenario}' のリクエストを処理中にエラーが発生しました。管理者に連絡してください。",
|
4
|
+
"error.scenario run unauthorized": "シナリオ {scenario} を実行する権限がありません。管理者に連絡してください。",
|
3
5
|
"error.schedule is not set": "スケジュールとして登録するためにはシナリオ'{scenario}'にスケジュール情報が設定される必要があります.",
|
4
6
|
"error.timezone is not set": "スケジュールとして登録するためにはシナリオ'{scenario}'にタイム ゾーン情報が設定される必要があります.",
|
5
7
|
"error.scenario instance not found": "シナリオ インスタンス'{instance}'が見つかりません. 既に終了している可能性があります.",
|
package/translations/ko.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"error.scenario not found": "시나리오 '{scenario}'를 찾을 수 없습니다.",
|
3
|
+
"error.scenario run error": "시나리오 '{scenario}' 요청을 처리하는 중 오류가 발생했습니다. 관리자에게 문의하십시오.",
|
4
|
+
"error.scenario run unauthorized": "시나리오 {scenario}를 실행할 권한이 없습니다. 관리자에게 문의하십히오.",
|
3
5
|
"error.schedule is not set": "스케쥴로 등록하기 위해서는 시나리오 '{scenario}'에 스케쥴 정보가 설정되어야 합니다.",
|
4
6
|
"error.timezone is not set": "스케쥴로 등록하기 위해서는 시나리오 '{scenario}'에 타임존 정보가 설정되어야 합니다.",
|
5
7
|
"error.scenario instance not found": "시나리오 인스턴스 '{instance}'를 찾을 수 없습니다. 이미 종료되었을 수 있습니다.",
|
package/translations/ms.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"error.scenario not found": "Tidak dapat mencari senario '{scenario}'.",
|
3
|
+
"error.scenario run error": "Ralat berlaku semasa memproses permintaan senario '{scenario}'. Sila hubungi pentadbir.",
|
4
|
+
"error.scenario run unauthorized": "Anda tidak mempunyai kebenaran untuk menjalankan senario {scenario}. Sila hubungi pentadbir.",
|
3
5
|
"error.schedule is not set": "Untuk mendaftarkan sebagai jadual, maklumat jadual mesti diset dalam senario '{scenario}'.",
|
4
6
|
"error.timezone is not set": "Untuk mendaftarkan sebagai jadual, maklumat zon masa mesti diset dalam senario '{scenario}'.",
|
5
7
|
"error.scenario instance not found": "Tidak dapat mencari instans senario '{instance}'. Mungkin telah berakhir.",
|
package/translations/zh.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"error.scenario not found": "无法找到场景 '{scenario}'。",
|
3
|
+
"error.scenario run error": "处理场景 '{scenario}' 请求时发生错误。请联系管理员。",
|
4
|
+
"error.scenario run unauthorized": "没有执行场景 {scenario} 的权限。请联系管理员。",
|
3
5
|
"error.schedule is not set": "要注册为计划,场景 '{scenario}' 需要设置计划信息。",
|
4
6
|
"error.timezone is not set": "要注册为计划,场景 '{scenario}' 需要设置时区信息。",
|
5
7
|
"error.scenario instance not found": "无法找到场景实例 '{instance}'。它可能已经结束。",
|