@things-factory/integration-base 6.2.24 → 6.2.27
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/assets/images/graphql-oauth2-menu.png +0 -0
- package/assets/images/graphql-oauth2-screen.png +0 -0
- package/dist-server/engine/connector/graphql-connector.js +3 -0
- package/dist-server/engine/connector/graphql-connector.js.map +1 -1
- package/dist-server/engine/connector/index.js +1 -0
- package/dist-server/engine/connector/index.js.map +1 -1
- package/dist-server/engine/connector/operato-connector.js +86 -0
- package/dist-server/engine/connector/operato-connector.js.map +1 -0
- package/dist-server/service/scenario/scenario-type.js +5 -49
- package/dist-server/service/scenario/scenario-type.js.map +1 -1
- package/dist-server/service/scenario-instance/scenario-instance-mutation.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/integration/connector/graphql-connector.md +23 -0
- package/helps/integration/connector/operato-connector.ja.md +26 -0
- package/helps/integration/connector/operato-connector.kr.md +28 -0
- package/helps/integration/connector/operato-connector.md +26 -0
- package/helps/integration/connector/operato-connector.ms.md +26 -0
- package/helps/integration/connector/operato-connector.zh.md +26 -0
- package/package.json +8 -8
- package/server/engine/connector/graphql-connector.ts +4 -0
- package/server/engine/connector/index.ts +1 -0
- package/server/engine/connector/operato-connector.ts +113 -0
- package/server/service/scenario/scenario-type.ts +1 -31
- package/server/service/scenario-instance/scenario-instance-mutation.ts +2 -2
- package/translations/en.json +2 -1
- package/translations/ja.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +2 -1
@@ -0,0 +1,23 @@
|
|
1
|
+
# graphql connector
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
A connector for connecting to a remote GraphQL server and performing queries or mutations. To connect to the GraphQL server on the internal server and perform queries or mutations, use the 'local-graphql-mutate' task and 'local-graphql-query' task without specifying a separate connector.
|
6
|
+
|
7
|
+
## Setting
|
8
|
+
|
9
|
+
### Endpoint
|
10
|
+
|
11
|
+
Specify the GraphQL server endpoint.
|
12
|
+
|
13
|
+
ex. *https://example.com/graphql*
|
14
|
+
|
15
|
+
## Parameters
|
16
|
+
|
17
|
+
### OAuth2 Client
|
18
|
+
|
19
|
+
- Specify the client created in advance for application OAuth2 authentication.
|
20
|
+
- Create a client for application OAuth2 authentication in the following menu of the Operato application.
|
21
|
+

|
22
|
+
- When you select this menu, you can create and manage OAuth2 clients as shown below, and the client created here can be selected as a parameter.
|
23
|
+

|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Operatoコネクタ
|
2
|
+
|
3
|
+
## 説明
|
4
|
+
|
5
|
+
- 外部の他のOperatoアプリケーションのデータを取得するか、データを変更または生成するためのコネクタです。
|
6
|
+
- GraphQLを基に動作し、queryまたはmutateタスクを実行できます。
|
7
|
+
- Operatoアプリケーションにアクセスするには、該当サーバーの管理者に別途認証キーを要求して取得する必要があります。
|
8
|
+
- Operatoアプリケーションにアクセスするには、実際に機能を実行しようとするドメインを指定する必要があります。
|
9
|
+
|
10
|
+
## 設定
|
11
|
+
|
12
|
+
### エンドポイント
|
13
|
+
|
14
|
+
GraphQLサーバーエンドポイントを指定します。
|
15
|
+
|
16
|
+
例: *https://abcd.hatioalb.com/graphql*
|
17
|
+
|
18
|
+
## パラメータ
|
19
|
+
|
20
|
+
### 認証キー
|
21
|
+
|
22
|
+
- 対象サーバー管理者から要求して受け取った認証キーを入力します。
|
23
|
+
|
24
|
+
### ドメイン
|
25
|
+
|
26
|
+
- 対象サーバーで動作させたいドメインを指定する必要があります。
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# operato connector
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
- 외부의 다른 Operato 어플리케이션의 데이터를 획득하거나 혹은 데이터를 변경 혹은 생성하기 위한 커넥터입니다.
|
6
|
+
- graphql을 기반으로 동작하며, query 혹은 mutate 태스크를 수행할 수 있습니다.
|
7
|
+
- Operato 어플리케이션에 접근하기 위해서는 별도의 인증 키를 해당 서버의 관리자에게 요청해서 받아야 합니다.
|
8
|
+
- Operato 어플리케이션에 접근하기 위해서는 실제로 기능을 수행하려고 하는 도메인을 지정해야 합니다.
|
9
|
+
|
10
|
+
## Setting
|
11
|
+
|
12
|
+
### 엔드포인트
|
13
|
+
|
14
|
+
Graphql 서버 엔드포인트를 지정합니다.
|
15
|
+
|
16
|
+
ex. *https://abcd.hatioalb.com/graphql*
|
17
|
+
|
18
|
+
|
19
|
+
## Parameters
|
20
|
+
|
21
|
+
### 인증 키
|
22
|
+
|
23
|
+
- 대상 서버 관리자로부터 요청해서 받은 인증 키를 입력합니다.
|
24
|
+
|
25
|
+
|
26
|
+
### 도메인
|
27
|
+
|
28
|
+
- 대상 서버에서 동작하고자 하는 도메인을 지정해야 합니다.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Operato Connector
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
- A connector for acquiring data from other external Operato applications or for changing or creating data.
|
6
|
+
- Operates based on GraphQL and can perform query or mutate tasks.
|
7
|
+
- To access the Operato application, a separate authentication key must be requested and obtained from the administrator of that server.
|
8
|
+
- To access the Operato application, you need to specify the actual domain for the functionality you want to perform.
|
9
|
+
|
10
|
+
## Setting
|
11
|
+
|
12
|
+
### Endpoint
|
13
|
+
|
14
|
+
Specify the GraphQL server endpoint.
|
15
|
+
|
16
|
+
ex. *https://abcd.hatioalb.com/graphql*
|
17
|
+
|
18
|
+
## Parameters
|
19
|
+
|
20
|
+
### Authentication Key
|
21
|
+
|
22
|
+
- Enter the authentication key received by requesting it from the target server administrator.
|
23
|
+
|
24
|
+
### Domain
|
25
|
+
|
26
|
+
- Specify the domain you want to operate on the target server.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# penyambung Operato
|
2
|
+
|
3
|
+
## Penerangan
|
4
|
+
|
5
|
+
- Sambung untuk mendapatkan data aplikasi Operato luaran atau mengubah atau membuat data.
|
6
|
+
- Berasaskan GraphQL dan boleh menjalankan tugasan kueri atau mutasi.
|
7
|
+
- Untuk mengakses aplikasi Operato, anda perlu meminta kunci pengesahan tambahan dari pentadbir server tersebut.
|
8
|
+
- Untuk mengakses aplikasi Operato, anda perlu menentukan domain yang sebenarnya untuk menjalankan fungsi.
|
9
|
+
|
10
|
+
## Tetapan
|
11
|
+
|
12
|
+
### Titik Akhir
|
13
|
+
|
14
|
+
Nyatakan titik akhir server GraphQL.
|
15
|
+
|
16
|
+
contoh: *https://abcd.hatioalb.com/graphql*
|
17
|
+
|
18
|
+
## Parameter
|
19
|
+
|
20
|
+
### Kunci Pengesahan
|
21
|
+
|
22
|
+
- Masukkan kunci pengesahan yang diterima daripada pentadbir server sasaran.
|
23
|
+
|
24
|
+
### Domain
|
25
|
+
|
26
|
+
- Anda perlu menentukan domain yang ingin beroperasi dari server sasaran.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Operato连接器
|
2
|
+
|
3
|
+
## 描述
|
4
|
+
|
5
|
+
- 连接器用于获取外部Operato应用程序的数据或更改或生成数据。
|
6
|
+
- 基于GraphQL工作,可以执行查询或变更任务。
|
7
|
+
- 要访问Operato应用程序,您需要向该服务器的管理员请求并获取单独的身份验证密钥。
|
8
|
+
- 要访问Operato应用程序,您实际上需要指定要执行功能的域。
|
9
|
+
|
10
|
+
## 设置
|
11
|
+
|
12
|
+
### 终点
|
13
|
+
|
14
|
+
指定GraphQL服务器终点。
|
15
|
+
|
16
|
+
例如:*https://abcd.hatioalb.com/graphql*
|
17
|
+
|
18
|
+
## 参数
|
19
|
+
|
20
|
+
### 认证密钥
|
21
|
+
|
22
|
+
- 输入从目标服务器管理员那里请求并获得的认证密钥。
|
23
|
+
|
24
|
+
### 领域
|
25
|
+
|
26
|
+
- 您需要指定要在目标服务器上运行的实际域。
|
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.27",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -26,12 +26,12 @@
|
|
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.
|
31
|
-
"@things-factory/env": "^6.2.
|
32
|
-
"@things-factory/oauth2-client": "^6.2.
|
33
|
-
"@things-factory/scheduler-client": "^6.2.
|
34
|
-
"@things-factory/shell": "^6.2.
|
29
|
+
"@things-factory/api": "^6.2.27",
|
30
|
+
"@things-factory/auth-base": "^6.2.27",
|
31
|
+
"@things-factory/env": "^6.2.27",
|
32
|
+
"@things-factory/oauth2-client": "^6.2.27",
|
33
|
+
"@things-factory/scheduler-client": "^6.2.27",
|
34
|
+
"@things-factory/shell": "^6.2.27",
|
35
35
|
"async-mqtt": "^2.5.0",
|
36
36
|
"chance": "^1.1.11",
|
37
37
|
"cross-fetch": "^3.0.4",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"devDependencies": {
|
47
47
|
"@types/cron": "^2.0.1"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "6d414311ca45c329e93606fe46edd7ea53c819c5"
|
50
50
|
}
|
@@ -113,6 +113,10 @@ export class GraphqlConnector implements Connector {
|
|
113
113
|
get description() {
|
114
114
|
return 'Graphql Http Connector'
|
115
115
|
}
|
116
|
+
|
117
|
+
get help() {
|
118
|
+
return 'integration/connector/graphql-connector'
|
119
|
+
}
|
116
120
|
}
|
117
121
|
|
118
122
|
ConnectionManager.registerConnector('graphql-connector', new GraphqlConnector())
|
@@ -0,0 +1,113 @@
|
|
1
|
+
import 'cross-fetch/polyfill'
|
2
|
+
|
3
|
+
import { ApolloClient, InMemoryCache, createHttpLink } from '@apollo/client/core'
|
4
|
+
import { setContext } from '@apollo/client/link/context'
|
5
|
+
|
6
|
+
import { ConnectionManager } from '../connection-manager'
|
7
|
+
import { Connector } from '../types'
|
8
|
+
|
9
|
+
const defaultOptions: any = {
|
10
|
+
watchQuery: {
|
11
|
+
fetchPolicy: 'no-cache',
|
12
|
+
errorPolicy: 'ignore'
|
13
|
+
},
|
14
|
+
query: {
|
15
|
+
fetchPolicy: 'no-cache', //'network-only'
|
16
|
+
errorPolicy: 'all'
|
17
|
+
},
|
18
|
+
mutate: {
|
19
|
+
errorPolicy: 'all'
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
const cache = new InMemoryCache({
|
24
|
+
addTypename: false
|
25
|
+
})
|
26
|
+
|
27
|
+
export class OperatoConnector implements Connector {
|
28
|
+
async ready(connectionConfigs) {
|
29
|
+
await Promise.all(connectionConfigs.map(this.connect.bind(this)))
|
30
|
+
|
31
|
+
ConnectionManager.logger.info('graphql-connector connections are ready')
|
32
|
+
}
|
33
|
+
|
34
|
+
async connect(connection) {
|
35
|
+
var {
|
36
|
+
endpoint: uri,
|
37
|
+
params: { authKey, domain }
|
38
|
+
} = connection
|
39
|
+
|
40
|
+
var ERROR_HANDLER: any = ({ graphQLErrors, networkError }) => {
|
41
|
+
if (graphQLErrors)
|
42
|
+
graphQLErrors.map(({ message, locations, path }) => {
|
43
|
+
ConnectionManager.logger.error(`[GraphQL error] Message: ${message}, Location: ${locations}, Path: ${path}`)
|
44
|
+
})
|
45
|
+
|
46
|
+
if (networkError) {
|
47
|
+
ConnectionManager.logger.error(`[Network error - ${networkError.statusCode}] ${networkError}`)
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
const httpLink = createHttpLink({
|
52
|
+
uri: uri
|
53
|
+
})
|
54
|
+
|
55
|
+
ConnectionManager.addConnectionInstance(
|
56
|
+
connection,
|
57
|
+
new ApolloClient({
|
58
|
+
defaultOptions,
|
59
|
+
cache,
|
60
|
+
link: setContext((_, { headers }) => {
|
61
|
+
return {
|
62
|
+
headers: {
|
63
|
+
...headers,
|
64
|
+
'x-things-factory-domain': domain,
|
65
|
+
authorization: authKey ? `Bearer ${authKey}` : ''
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}).concat(httpLink)
|
69
|
+
})
|
70
|
+
)
|
71
|
+
|
72
|
+
ConnectionManager.logger.info(
|
73
|
+
`graphql-connector connection(${connection.name}:${connection.endpoint}) is connected`
|
74
|
+
)
|
75
|
+
}
|
76
|
+
|
77
|
+
async disconnect(connection) {
|
78
|
+
var client = ConnectionManager.getConnectionInstance(connection)
|
79
|
+
client.stop()
|
80
|
+
ConnectionManager.removeConnectionInstance(connection)
|
81
|
+
|
82
|
+
ConnectionManager.logger.info(`graphql-connector connection(${connection.name}) is disconnected`)
|
83
|
+
}
|
84
|
+
|
85
|
+
get parameterSpec() {
|
86
|
+
return [
|
87
|
+
{
|
88
|
+
type: 'string',
|
89
|
+
name: 'authKey',
|
90
|
+
label: 'auth-key'
|
91
|
+
},
|
92
|
+
{
|
93
|
+
type: 'string',
|
94
|
+
name: 'domain',
|
95
|
+
label: 'domain'
|
96
|
+
}
|
97
|
+
]
|
98
|
+
}
|
99
|
+
|
100
|
+
get taskPrefixes() {
|
101
|
+
return ['graphql']
|
102
|
+
}
|
103
|
+
|
104
|
+
get help() {
|
105
|
+
return 'integration/connector/operato-connector'
|
106
|
+
}
|
107
|
+
|
108
|
+
get description() {
|
109
|
+
return 'Operato Grpahql Connector'
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
ConnectionManager.registerConnector('operato-connector', new OperatoConnector())
|
@@ -11,27 +11,12 @@ import {
|
|
11
11
|
UpdateDateColumn
|
12
12
|
} from 'typeorm'
|
13
13
|
|
14
|
-
import {
|
14
|
+
import { PrivilegeObject, PrivilegeInput, User } from '@things-factory/auth-base'
|
15
15
|
import { Domain } from '@things-factory/shell'
|
16
16
|
|
17
17
|
import { ScenarioEngine } from '../../engine'
|
18
18
|
import { Step, StepPatch } from '../step/step-type'
|
19
19
|
|
20
|
-
@ObjectType()
|
21
|
-
export class PrivilegeObject {
|
22
|
-
@Field({ nullable: true })
|
23
|
-
privilege?: string
|
24
|
-
|
25
|
-
@Field({ nullable: true })
|
26
|
-
category?: string
|
27
|
-
|
28
|
-
@Field({ nullable: true })
|
29
|
-
owner?: boolean
|
30
|
-
|
31
|
-
@Field({ nullable: true })
|
32
|
-
super?: boolean
|
33
|
-
}
|
34
|
-
|
35
20
|
@Entity()
|
36
21
|
@Index('ix_scenario_0', (scenario: Scenario) => [scenario.domain, scenario.name], { unique: true })
|
37
22
|
@ObjectType()
|
@@ -123,21 +108,6 @@ export class Scenario {
|
|
123
108
|
}
|
124
109
|
}
|
125
110
|
|
126
|
-
@InputType()
|
127
|
-
export class PrivilegeInput {
|
128
|
-
@Field({ nullable: true })
|
129
|
-
privilege?: string
|
130
|
-
|
131
|
-
@Field({ nullable: true })
|
132
|
-
category?: string
|
133
|
-
|
134
|
-
@Field({ nullable: true })
|
135
|
-
owner?: boolean
|
136
|
-
|
137
|
-
@Field({ nullable: true })
|
138
|
-
super?: boolean
|
139
|
-
}
|
140
|
-
|
141
111
|
@InputType()
|
142
112
|
export class NewScenario {
|
143
113
|
@Field()
|
@@ -3,9 +3,9 @@ import { Arg, Ctx, Mutation, Resolver } from 'type-graphql'
|
|
3
3
|
import { getRepository, Domain, GraphqlLocalClient, ScalarObject } from '@things-factory/shell'
|
4
4
|
|
5
5
|
import { ScenarioEngine } from '../../engine'
|
6
|
-
import {
|
6
|
+
import { Scenario } from '../scenario/scenario-type'
|
7
7
|
import { ScenarioInstance } from './scenario-instance-type'
|
8
|
-
import { User } from '@things-factory/auth-base'
|
8
|
+
import { PrivilegeObject, User } from '@things-factory/auth-base'
|
9
9
|
import { Step } from '../step/step-type'
|
10
10
|
|
11
11
|
const debug = require('debug')('things-factory:integration-base:scenario-instance-mutation')
|
package/translations/en.json
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
"error.scenario not found": "scenario '{scenario}' not found.",
|
3
3
|
"error.schedule is not set": "schedule should be set for the scenario '{scenario}' in order to register as a schedule",
|
4
4
|
"error.timezone is not set": "timezone should be set for the scenario '{scenario}' in order to register as a schedule",
|
5
|
-
"error.scenario instance not found": "scenario instance '{instance}' not found."
|
5
|
+
"error.scenario instance not found": "scenario instance '{instance}' not found.",
|
6
|
+
"label.auth-key": "authentication key"
|
6
7
|
}
|
package/translations/ja.json
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
"error.scenario not found": "シナリオ'{scenario}'が見つかりません.",
|
3
3
|
"error.schedule is not set": "スケジュールとして登録するためにはシナリオ'{scenario}'にスケジュール情報が設定される必要があります.",
|
4
4
|
"error.timezone is not set": "スケジュールとして登録するためにはシナリオ'{scenario}'にタイム ゾーン情報が設定される必要があります.",
|
5
|
-
"error.scenario instance not found": "シナリオ インスタンス'{instance}'が見つかりません. 既に終了している可能性があります."
|
5
|
+
"error.scenario instance not found": "シナリオ インスタンス'{instance}'が見つかりません. 既に終了している可能性があります.",
|
6
|
+
"label.auth-key": "認証キー"
|
6
7
|
}
|
package/translations/ko.json
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
"error.scenario not found": "시나리오 '{scenario}'를 찾을 수 없습니다.",
|
3
3
|
"error.schedule is not set": "스케쥴로 등록하기 위해서는 시나리오 '{scenario}'에 스케쥴 정보가 설정되어야 합니다.",
|
4
4
|
"error.timezone is not set": "스케쥴로 등록하기 위해서는 시나리오 '{scenario}'에 타임존 정보가 설정되어야 합니다.",
|
5
|
-
"error.scenario instance not found": "시나리오 인스턴스 '{instance}'를 찾을 수 없습니다. 이미 종료되었을 수 있습니다."
|
5
|
+
"error.scenario instance not found": "시나리오 인스턴스 '{instance}'를 찾을 수 없습니다. 이미 종료되었을 수 있습니다.",
|
6
|
+
"label.auth-key": "인증 키"
|
6
7
|
}
|
package/translations/ms.json
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
"error.scenario not found": "Tidak dapat mencari senario '{scenario}'.",
|
3
3
|
"error.schedule is not set": "Untuk mendaftarkan sebagai jadual, maklumat jadual mesti diset dalam senario '{scenario}'.",
|
4
4
|
"error.timezone is not set": "Untuk mendaftarkan sebagai jadual, maklumat zon masa mesti diset dalam senario '{scenario}'.",
|
5
|
-
"error.scenario instance not found": "Tidak dapat mencari instans senario '{instance}'. Mungkin telah berakhir."
|
5
|
+
"error.scenario instance not found": "Tidak dapat mencari instans senario '{instance}'. Mungkin telah berakhir.",
|
6
|
+
"label.auth-key": "Kunci pengesahan"
|
6
7
|
}
|
package/translations/zh.json
CHANGED
@@ -2,5 +2,6 @@
|
|
2
2
|
"error.scenario not found": "无法找到场景 '{scenario}'。",
|
3
3
|
"error.schedule is not set": "要注册为计划,场景 '{scenario}' 需要设置计划信息。",
|
4
4
|
"error.timezone is not set": "要注册为计划,场景 '{scenario}' 需要设置时区信息。",
|
5
|
-
"error.scenario instance not found": "无法找到场景实例 '{instance}'。它可能已经结束。"
|
5
|
+
"error.scenario instance not found": "无法找到场景实例 '{instance}'。它可能已经结束。",
|
6
|
+
"label.auth-key": "认证密钥"
|
6
7
|
}
|