@things-factory/integration-base 9.0.5 → 9.0.12
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/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/connector/pyrun-connector.d.ts +16 -0
- package/dist-server/engine/connector/pyrun-connector.js +56 -0
- package/dist-server/engine/connector/pyrun-connector.js.map +1 -0
- package/dist-server/engine/task/index.d.ts +1 -0
- package/dist-server/engine/task/index.js +1 -0
- package/dist-server/engine/task/index.js.map +1 -1
- package/dist-server/engine/task/publish.js +4 -1
- package/dist-server/engine/task/publish.js.map +1 -1
- package/dist-server/engine/task/pyrun-execute.d.ts +1 -0
- package/dist-server/engine/task/pyrun-execute.js +43 -0
- package/dist-server/engine/task/pyrun-execute.js.map +1 -0
- package/dist-server/engine/task/state-read.js +4 -1
- package/dist-server/engine/task/state-read.js.map +1 -1
- package/dist-server/engine/task/state-write.js +4 -1
- package/dist-server/engine/task/state-write.js.map +1 -1
- package/dist-server/engine/task/utils/substitute-multi.d.ts +7 -0
- package/dist-server/engine/task/utils/substitute-multi.js +37 -0
- package/dist-server/engine/task/utils/substitute-multi.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/integration/connector/pyrun-connector.ja.md +55 -0
- package/helps/integration/connector/pyrun-connector.ko.md +55 -0
- package/helps/integration/connector/pyrun-connector.md +55 -0
- package/helps/integration/connector/pyrun-connector.ms.md +55 -0
- package/helps/integration/connector/pyrun-connector.zh.md +55 -0
- package/helps/integration/task/publish.ja.md +46 -8
- package/helps/integration/task/publish.ko.md +40 -2
- package/helps/integration/task/publish.md +42 -4
- package/helps/integration/task/publish.ms.md +42 -4
- package/helps/integration/task/publish.zh.md +45 -4
- package/helps/integration/task/pyrun-execute.ja.md +36 -0
- package/helps/integration/task/pyrun-execute.ko.md +36 -0
- package/helps/integration/task/pyrun-execute.md +36 -0
- package/helps/integration/task/pyrun-execute.ms.md +36 -0
- package/helps/integration/task/pyrun-execute.zh.md +36 -0
- package/helps/integration/task/state-read.ja.md +42 -2
- package/helps/integration/task/state-read.ko.md +42 -2
- package/helps/integration/task/state-read.md +42 -2
- package/helps/integration/task/state-read.ms.md +42 -2
- package/helps/integration/task/state-read.zh.md +42 -2
- package/helps/integration/task/state-write.ja.md +43 -0
- package/helps/integration/task/state-write.ko.md +43 -0
- package/helps/integration/task/state-write.md +46 -3
- package/helps/integration/task/state-write.ms.md +43 -0
- package/helps/integration/task/state-write.zh.md +44 -1
- package/package.json +2 -2
- package/translations/en.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
# pyrun-connector
|
2
|
+
|
3
|
+
Python Runner(pyrun)REST APIと連携するためのコネクタです。
|
4
|
+
pyrunサーバーのREST API(例:`/api/run/{module}`)を呼び出して、Pythonモジュールの実行結果を取得できます。
|
5
|
+
|
6
|
+
## パラメータ
|
7
|
+
|
8
|
+
- **endpoint**: pyrunサーバーのURL(例:`http://runner.hatiolab.com:8000`)
|
9
|
+
- **username**: (任意)pyrunサーバーにログインするユーザー名(認証が必要な場合)
|
10
|
+
- **password**: (任意)pyrunサーバーにログインするパスワード(認証が必要な場合)
|
11
|
+
- **token**: (任意)Bearer認証トークン。直接入力するか、username/passwordでログイン時に自動発行されます。
|
12
|
+
|
13
|
+
> pyrunサーバーが認証を要求しない場合は、endpointのみ入力してください。
|
14
|
+
> 認証が必要な場合は、username/passwordを入力すると、コネクタが`/auth/login` APIを通じてトークンを自動取得して使用します。
|
15
|
+
> すでにトークンを持っている場合は、tokenのみ入力してください。
|
16
|
+
|
17
|
+
## 動作仕様
|
18
|
+
|
19
|
+
- usernameとpasswordが両方入力されている場合、`/auth/login`エンドポイントにログインリクエストを送り、レスポンスから`access_token`を抽出して使用します。
|
20
|
+
- tokenが入力されている場合は、AuthorizationヘッダーのBearerトークンとしてそのまま使用します。
|
21
|
+
- 認証情報がない場合は、認証なしでpyrun APIを呼び出します。
|
22
|
+
- 認証に失敗した場合はエラーメッセージが返されます。
|
23
|
+
|
24
|
+
## 使用例
|
25
|
+
|
26
|
+
```json
|
27
|
+
{
|
28
|
+
"type": "pyrun-connector",
|
29
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
30
|
+
"params": {
|
31
|
+
"username": "your username",
|
32
|
+
"password": "your password"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
または
|
38
|
+
|
39
|
+
```json
|
40
|
+
{
|
41
|
+
"type": "pyrun-connector",
|
42
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
43
|
+
"params": {
|
44
|
+
"token": "your-access-token"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## 注意事項
|
50
|
+
|
51
|
+
- Basic認証(Authorization: Basic ...)はサポートされていません。
|
52
|
+
- username/passwordを入力すると、自動的にトークンが発行されて使用されます。
|
53
|
+
- tokenのみ入力した場合は、そのままBearer認証として使用されます。
|
54
|
+
- pyrunサーバーの認証ポリシーに従って、必要なパラメータを入力してください。
|
55
|
+
- 認証に失敗した場合、`"pyrun-connector 認証失敗: [ステータスコード] [エラーメッセージ]"`のようなエラーが発生することがあります。
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# pyrun-connector
|
2
|
+
|
3
|
+
Python Runner(pyrun) REST API와 연동하기 위한 커넥터입니다.
|
4
|
+
pyrun 서버의 REST API(예: `/api/run/{module}`)를 호출하여 파이썬 모듈 실행 결과를 받아올 수 있습니다.
|
5
|
+
|
6
|
+
## 파라미터
|
7
|
+
|
8
|
+
- **endpoint**: pyrun 서버의 URL (예: `http://runner.hatiolab.com:8000`)
|
9
|
+
- **username**: (선택) pyrun 서버에 로그인할 사용자명. (인증이 필요한 경우)
|
10
|
+
- **password**: (선택) pyrun 서버에 로그인할 비밀번호. (인증이 필요한 경우)
|
11
|
+
- **token**: (선택) Bearer 인증 토큰. 직접 입력하거나, username/password로 로그인 시 자동 발급받아 사용합니다.
|
12
|
+
|
13
|
+
> pyrun 서버가 인증을 요구하지 않는 경우, endpoint만 입력하면 됩니다.
|
14
|
+
> 인증이 필요한 경우, username/password를 입력하면 `/auth/login` API를 통해 토큰을 자동으로 발급받아 사용합니다.
|
15
|
+
> 이미 발급받은 토큰이 있다면 token만 입력해도 됩니다.
|
16
|
+
|
17
|
+
## 동작 방식
|
18
|
+
|
19
|
+
- username/password가 모두 입력되면 `/auth/login` 엔드포인트로 로그인 요청을 보내고, 응답에서 `access_token`을 추출하여 사용합니다.
|
20
|
+
- token이 입력된 경우, 바로 Authorization 헤더(`Bearer {token}`)로 pyrun API를 호출합니다.
|
21
|
+
- 인증 정보가 모두 없으면 인증 없이 pyrun API를 호출합니다.
|
22
|
+
- 인증 실패 시 에러 메시지가 반환됩니다.
|
23
|
+
|
24
|
+
## 사용 예시
|
25
|
+
|
26
|
+
```json
|
27
|
+
{
|
28
|
+
"type": "pyrun-connector",
|
29
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
30
|
+
"params": {
|
31
|
+
"username": "your username",
|
32
|
+
"password": "your password"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
또는
|
38
|
+
|
39
|
+
```json
|
40
|
+
{
|
41
|
+
"type": "pyrun-connector",
|
42
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
43
|
+
"params": {
|
44
|
+
"token": "your-access-token"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## 참고
|
50
|
+
|
51
|
+
- Basic 인증(Authorization: Basic ...)은 지원하지 않습니다.
|
52
|
+
- username/password를 입력하면 자동으로 토큰을 발급받아 사용합니다.
|
53
|
+
- token만 입력하면 바로 Bearer 인증으로 사용합니다.
|
54
|
+
- pyrun 서버의 인증 정책에 따라 파라미터를 선택적으로 입력하세요.
|
55
|
+
- 인증 실패 시 `"pyrun-connector 인증 실패: [상태코드] [에러메시지]"` 형태의 에러가 발생할 수 있습니다.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# pyrun-connector
|
2
|
+
|
3
|
+
This connector is for integrating with the Python Runner (pyrun) REST API.
|
4
|
+
You can use it to call the pyrun server's REST API (e.g., `/api/run/{module}`) and receive the result of running a Python module.
|
5
|
+
|
6
|
+
## Parameters
|
7
|
+
|
8
|
+
- **endpoint**: The URL of the pyrun server (e.g., `http://runner.hatiolab.com:8000`)
|
9
|
+
- **username**: (Optional) Username for logging in to the pyrun server (if authentication is required)
|
10
|
+
- **password**: (Optional) Password for logging in to the pyrun server (if authentication is required)
|
11
|
+
- **token**: (Optional) Bearer authentication token. You can enter it directly, or it will be automatically issued and used if you log in with username/password.
|
12
|
+
|
13
|
+
> If the pyrun server does not require authentication, just enter the endpoint.
|
14
|
+
> If authentication is required, enter username/password and the connector will automatically obtain a token via the `/auth/login` API.
|
15
|
+
> If you already have a token, you can enter only the token.
|
16
|
+
|
17
|
+
## How it works
|
18
|
+
|
19
|
+
- If both username and password are provided, the connector sends a login request to the `/auth/login` endpoint and extracts the `access_token` from the response.
|
20
|
+
- If a token is provided, it is used directly as a Bearer token in the Authorization header for pyrun API calls.
|
21
|
+
- If no authentication information is provided, the pyrun API is called without authentication.
|
22
|
+
- If authentication fails, an error message is returned.
|
23
|
+
|
24
|
+
## Example
|
25
|
+
|
26
|
+
```json
|
27
|
+
{
|
28
|
+
"type": "pyrun-connector",
|
29
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
30
|
+
"params": {
|
31
|
+
"username": "your username",
|
32
|
+
"password": "your password"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
Or
|
38
|
+
|
39
|
+
```json
|
40
|
+
{
|
41
|
+
"type": "pyrun-connector",
|
42
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
43
|
+
"params": {
|
44
|
+
"token": "your-access-token"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## Notes
|
50
|
+
|
51
|
+
- Basic authentication (Authorization: Basic ...) is not supported.
|
52
|
+
- If you enter username/password, a token is automatically issued and used.
|
53
|
+
- If you enter only a token, it is used directly as Bearer authentication.
|
54
|
+
- Enter parameters as needed according to the pyrun server's authentication policy.
|
55
|
+
- If authentication fails, you may see an error like: `"pyrun-connector authentication failed: [status code] [error message]"`.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# pyrun-connector
|
2
|
+
|
3
|
+
Penyambung ini digunakan untuk integrasi dengan Python Runner (pyrun) REST API.
|
4
|
+
Anda boleh memanggil REST API pelayan pyrun (cth: `/api/run/{module}`) dan menerima hasil pelaksanaan modul Python.
|
5
|
+
|
6
|
+
## Parameter
|
7
|
+
|
8
|
+
- **endpoint**: URL pelayan pyrun (cth: `http://runner.hatiolab.com:8000`)
|
9
|
+
- **username**: (Pilihan) Nama pengguna untuk log masuk ke pelayan pyrun (jika perlu pengesahan)
|
10
|
+
- **password**: (Pilihan) Kata laluan untuk log masuk ke pelayan pyrun (jika perlu pengesahan)
|
11
|
+
- **token**: (Pilihan) Token pengesahan Bearer. Anda boleh masukkan secara langsung, atau ia akan dijana dan digunakan secara automatik jika anda log masuk dengan username/password.
|
12
|
+
|
13
|
+
> Jika pelayan pyrun tidak memerlukan pengesahan, hanya masukkan endpoint.
|
14
|
+
> Jika perlu pengesahan, masukkan username/password dan penyambung akan mendapatkan token secara automatik melalui API `/auth/login`.
|
15
|
+
> Jika anda sudah mempunyai token, hanya masukkan token sahaja.
|
16
|
+
|
17
|
+
## Cara Kerja
|
18
|
+
|
19
|
+
- Jika kedua-dua username dan password diberikan, penyambung akan menghantar permintaan log masuk ke endpoint `/auth/login` dan mengekstrak `access_token` dari respons.
|
20
|
+
- Jika token diberikan, ia akan digunakan secara langsung sebagai Bearer token dalam header Authorization untuk panggilan API pyrun.
|
21
|
+
- Jika tiada maklumat pengesahan diberikan, API pyrun akan dipanggil tanpa pengesahan.
|
22
|
+
- Jika pengesahan gagal, mesej ralat akan dipaparkan.
|
23
|
+
|
24
|
+
## Contoh Penggunaan
|
25
|
+
|
26
|
+
```json
|
27
|
+
{
|
28
|
+
"type": "pyrun-connector",
|
29
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
30
|
+
"params": {
|
31
|
+
"username": "your username",
|
32
|
+
"password": "your password"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
Atau
|
38
|
+
|
39
|
+
```json
|
40
|
+
{
|
41
|
+
"type": "pyrun-connector",
|
42
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
43
|
+
"params": {
|
44
|
+
"token": "your-access-token"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## Nota
|
50
|
+
|
51
|
+
- Pengesahan Basic (Authorization: Basic ...) tidak disokong.
|
52
|
+
- Jika anda masukkan username/password, token akan dijana dan digunakan secara automatik.
|
53
|
+
- Jika anda hanya masukkan token, ia akan digunakan terus sebagai pengesahan Bearer.
|
54
|
+
- Masukkan parameter mengikut keperluan dasar pengesahan pelayan pyrun.
|
55
|
+
- Jika pengesahan gagal, anda mungkin akan menerima ralat seperti: `"pyrun-connector pengesahan gagal: [kod status] [mesej ralat]"`.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# pyrun-connector
|
2
|
+
|
3
|
+
用于与 Python Runner (pyrun) REST API 集成的连接器。
|
4
|
+
可以调用 pyrun 服务器的 REST API(如 `/api/run/{module}`),并获取 Python 模块的执行结果。
|
5
|
+
|
6
|
+
## 参数
|
7
|
+
|
8
|
+
- **endpoint**: pyrun 服务器的 URL(例如:`http://runner.hatiolab.com:8000`)
|
9
|
+
- **username**: (可选)登录 pyrun 服务器的用户名(如需认证时)
|
10
|
+
- **password**: (可选)登录 pyrun 服务器的密码(如需认证时)
|
11
|
+
- **token**: (可选)Bearer 认证令牌。可直接输入,或通过输入用户名/密码自动获取并使用。
|
12
|
+
|
13
|
+
> 如果 pyrun 服务器不需要认证,只需输入 endpoint。
|
14
|
+
> 如果需要认证,输入 username/password,连接器会通过 `/auth/login` API 自动获取令牌。
|
15
|
+
> 如果已有令牌,只需输入 token 即可。
|
16
|
+
|
17
|
+
## 工作方式
|
18
|
+
|
19
|
+
- 同时输入 username 和 password 时,连接器会向 `/auth/login` 端点发送登录请求,并从响应中提取 `access_token`。
|
20
|
+
- 输入 token 时,直接作为 Bearer 令牌用于 Authorization 头部调用 pyrun API。
|
21
|
+
- 未输入认证信息时,将不带认证信息调用 pyrun API。
|
22
|
+
- 认证失败时会返回错误信息。
|
23
|
+
|
24
|
+
## 使用示例
|
25
|
+
|
26
|
+
```json
|
27
|
+
{
|
28
|
+
"type": "pyrun-connector",
|
29
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
30
|
+
"params": {
|
31
|
+
"username": "your username",
|
32
|
+
"password": "your password"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
```
|
36
|
+
|
37
|
+
或
|
38
|
+
|
39
|
+
```json
|
40
|
+
{
|
41
|
+
"type": "pyrun-connector",
|
42
|
+
"endpoint": "http://runner.hatiolab.com:8000",
|
43
|
+
"params": {
|
44
|
+
"token": "your-access-token"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
```
|
48
|
+
|
49
|
+
## 备注
|
50
|
+
|
51
|
+
- 不支持 Basic 认证(Authorization: Basic ...)。
|
52
|
+
- 输入 username/password 时会自动获取并使用令牌。
|
53
|
+
- 仅输入 token 时直接作为 Bearer 认证使用。
|
54
|
+
- 请根据 pyrun 服务器的认证策略选择性输入参数。
|
55
|
+
- 认证失败时,可能会出现如下错误:`"pyrun-connector 认证失败: [状态码] [错误信息]"`。
|
@@ -1,16 +1,54 @@
|
|
1
1
|
# publish
|
2
2
|
|
3
|
-
|
3
|
+
subscription APIを介して要求されたすべてのSubscriberにデータをブロードキャストするタスクです。
|
4
4
|
|
5
|
-
|
5
|
+
クライアントアプリケーションでデータサブスクリプションを要求する方法は以下の通りです:
|
6
6
|
|
7
|
-
-
|
8
|
-
- wss://[server host:port]/subscription APIを介してsubscribe
|
7
|
+
- Board UIでsubscriberを通じて要求できます。
|
8
|
+
- wss://[server host:port]/subscription APIを介してsubscribe要求できます。
|
9
9
|
|
10
|
-
##
|
10
|
+
## パラメーター
|
11
11
|
|
12
|
-
-
|
13
|
-
- シナリオ内のステップ名で、ブロードキャストしたいデータを指定します。
|
14
|
-
- タグ
|
12
|
+
- tag
|
15
13
|
- データをブロードキャストする際には、タグを付けて送る必要があります。
|
16
14
|
- Subscriberもデータをsubscribeする際には、受け取りたいタグを設定して、該当のタグが付いたブロードキャストだけを受信できます。
|
15
|
+
- **動的サポート**: 以下のパターンを使用した動的置換をサポートします:
|
16
|
+
- `#{user.id}_status` - #{...} パターン使用
|
17
|
+
- `${user.role}_prefs` - ${...} パターン使用
|
18
|
+
- `{{domain.name}}_data` - {{...}} パターン使用
|
19
|
+
- `static_name` - 静的名前 (置換なし)
|
20
|
+
|
21
|
+
## 使用例
|
22
|
+
|
23
|
+
### 静的使用
|
24
|
+
|
25
|
+
```json
|
26
|
+
{
|
27
|
+
"task": "publish",
|
28
|
+
"params": {
|
29
|
+
"tag": "machine"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
### 動的使用
|
35
|
+
|
36
|
+
```json
|
37
|
+
{
|
38
|
+
"task": "publish",
|
39
|
+
"params": {
|
40
|
+
"tag": "#{machine.code}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
44
|
+
|
45
|
+
### 混合使用
|
46
|
+
|
47
|
+
```json
|
48
|
+
{
|
49
|
+
"task": "publish",
|
50
|
+
"params": {
|
51
|
+
"tag": "#{machine.code}_${sensor.code}"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
@@ -9,8 +9,46 @@ subscription API를 통해서 요청된 모든 Subscriber에게 데이타를 브
|
|
9
9
|
|
10
10
|
## parameters
|
11
11
|
|
12
|
-
- [accessor](../concept/data-accessor.md)
|
13
|
-
- 시나리오 내의 하나의 스텝이름으로, 브로드캐스트하고자 하는 데이타를 지정한다.
|
14
12
|
- tag
|
15
13
|
- 데이타를 브로드캐스트할 때 태그를 부여해서 보내야한다.
|
16
14
|
- subscriber들도 data를 subscribe할 때, 받고자 하는 테그를 설정하여, 해당 태그가 부여된 브로드캐스트만 받을 수 있다.
|
15
|
+
- **동적 지원**: 다음 패턴을 사용한 동적 치환을 지원합니다:
|
16
|
+
- `#{user.id}_status` - #{...} 패턴 사용
|
17
|
+
- `${user.role}_prefs` - ${...} 패턴 사용
|
18
|
+
- `{{domain.name}}_data` - {{...}} 패턴 사용
|
19
|
+
- `static_name` - 정적 이름 (치환 없음)
|
20
|
+
|
21
|
+
## 사용 예시
|
22
|
+
|
23
|
+
### 정적 사용
|
24
|
+
|
25
|
+
```json
|
26
|
+
{
|
27
|
+
"task": "publish",
|
28
|
+
"params": {
|
29
|
+
"tag": "machine"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
### 동적 사용
|
35
|
+
|
36
|
+
```json
|
37
|
+
{
|
38
|
+
"task": "publish",
|
39
|
+
"params": {
|
40
|
+
"tag": "#{machine.code}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
44
|
+
|
45
|
+
### 혼합 사용
|
46
|
+
|
47
|
+
```json
|
48
|
+
{
|
49
|
+
"task": "publish",
|
50
|
+
"params": {
|
51
|
+
"tag": "#{machine.code}_${sensor.code}"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
@@ -7,10 +7,48 @@ Ways to request data subscription in client applications include:
|
|
7
7
|
- It can be requested through the Board UI via subscribers.
|
8
8
|
- Subscription requests can be made through the wss://[server host:port]/subscription API.
|
9
9
|
|
10
|
-
##
|
10
|
+
## parameters
|
11
11
|
|
12
|
-
-
|
13
|
-
- As a step name within the scenario, specifies the data to be broadcast.
|
14
|
-
- Tag
|
12
|
+
- tag
|
15
13
|
- When broadcasting data, it is necessary to attach a tag.
|
16
14
|
- When subscribers subscribe to data, they can receive only broadcasts with the specified tag.
|
15
|
+
- **Dynamic Support**: Supports dynamic substitution using the following patterns:
|
16
|
+
- `#{user.id}_status` - Using #{...} pattern
|
17
|
+
- `${user.role}_prefs` - Using ${...} pattern
|
18
|
+
- `{{domain.name}}_data` - Using {{...}} pattern
|
19
|
+
- `static_name` - Static name (no substitution)
|
20
|
+
|
21
|
+
## Usage Examples
|
22
|
+
|
23
|
+
### Static Usage
|
24
|
+
|
25
|
+
```json
|
26
|
+
{
|
27
|
+
"task": "publish",
|
28
|
+
"params": {
|
29
|
+
"tag": "machine"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
### Dynamic Usage
|
35
|
+
|
36
|
+
```json
|
37
|
+
{
|
38
|
+
"task": "publish",
|
39
|
+
"params": {
|
40
|
+
"tag": "#{machine.code}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
44
|
+
|
45
|
+
### Mixed Usage
|
46
|
+
|
47
|
+
```json
|
48
|
+
{
|
49
|
+
"task": "publish",
|
50
|
+
"params": {
|
51
|
+
"tag": "#{machine.code}_${sensor.code}"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
@@ -7,10 +7,48 @@ Cara untuk meminta langganan data dalam aplikasi klien termasuk:
|
|
7
7
|
- Ini dapat diminta melalui Board UI melalui subscriber.
|
8
8
|
- Permintaan langganan dapat dilakukan melalui wss://[server host:port]/subscription API.
|
9
9
|
|
10
|
-
##
|
10
|
+
## parameter
|
11
11
|
|
12
|
-
-
|
13
|
-
- Sebagai nama langkah dalam skenario, menentukan data yang akan disiarkan.
|
14
|
-
- Tag
|
12
|
+
- tag
|
15
13
|
- Ketika menyiarkan data, perlu melampirkan tag.
|
16
14
|
- Ketika subscriber berlangganan data, mereka hanya dapat menerima siaran dengan tag yang ditentukan.
|
15
|
+
- **Sokongan Dinamik**: Menyokong penggantian dinamik menggunakan corak:
|
16
|
+
- `#{user.id}_status` - Menggunakan corak #{...}
|
17
|
+
- `${user.role}_prefs` - Menggunakan corak ${...}
|
18
|
+
- `{{domain.name}}_data` - Menggunakan corak {{...}}
|
19
|
+
- `static_name` - Nama statik (tiada penggantian)
|
20
|
+
|
21
|
+
## Contoh Penggunaan
|
22
|
+
|
23
|
+
### Penggunaan Statik
|
24
|
+
|
25
|
+
```json
|
26
|
+
{
|
27
|
+
"task": "publish",
|
28
|
+
"params": {
|
29
|
+
"tag": "machine"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
### Penggunaan Dinamik
|
35
|
+
|
36
|
+
```json
|
37
|
+
{
|
38
|
+
"task": "publish",
|
39
|
+
"params": {
|
40
|
+
"tag": "#{machine.code}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
44
|
+
|
45
|
+
### Penggunaan Campuran
|
46
|
+
|
47
|
+
```json
|
48
|
+
{
|
49
|
+
"task": "publish",
|
50
|
+
"params": {
|
51
|
+
"tag": "#{machine.code}_${sensor.code}"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
@@ -4,13 +4,54 @@
|
|
4
4
|
|
5
5
|
客户端应用程序请求数据订阅的方式包括:
|
6
6
|
|
7
|
-
- 可以通过Board UI
|
7
|
+
- 可以通过Board UI通过subscriber请求。
|
8
8
|
- 可以通过wss://[server host:port]/subscription API进行订阅请求。
|
9
9
|
|
10
10
|
## 参数
|
11
11
|
|
12
|
+
- tag
|
13
|
+
- 广播数据时,需要附加标签。
|
14
|
+
- 当订阅者订阅数据时,他们只能接收带有指定标签的广播。
|
15
|
+
- **动态支持**: 支持使用以下模式的动态替换:
|
16
|
+
- `#{user.id}_status` - 使用 #{...} 模式
|
17
|
+
- `${user.role}_prefs` - 使用 ${...} 模式
|
18
|
+
- `{{domain.name}}_data` - 使用 {{...}} 模式
|
19
|
+
- `static_name` - 静态名称 (无替换)
|
20
|
+
|
21
|
+
## 使用示例
|
22
|
+
|
23
|
+
### 静态使用
|
24
|
+
|
25
|
+
```json
|
26
|
+
{
|
27
|
+
"task": "publish",
|
28
|
+
"params": {
|
29
|
+
"tag": "machine"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
### 动态使用
|
35
|
+
|
36
|
+
```json
|
37
|
+
{
|
38
|
+
"task": "publish",
|
39
|
+
"params": {
|
40
|
+
"tag": "#{machine.code}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
```
|
44
|
+
|
45
|
+
### 混合使用
|
46
|
+
|
47
|
+
```json
|
48
|
+
{
|
49
|
+
"task": "publish",
|
50
|
+
"params": {
|
51
|
+
"tag": "#{machine.code}_${sensor.code}"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
12
56
|
- [存取器](../concept/data-accessor.md)
|
13
57
|
- 作为场景中的步骤名称,指定要广播的数据。
|
14
|
-
- 标签
|
15
|
-
- 在广播数据时,需要附加标签。
|
16
|
-
- 当订阅者订阅数据时,他们只能接收具有指定标签的广播。
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# pyrun-execute
|
2
|
+
|
3
|
+
pyrun-connector を通じて Python Runner(pyrun)サーバーの REST API(`/api/run/{module}`)を呼び出し、
|
4
|
+
指定した Python モジュールを実行し、その結果を返すタスクです。
|
5
|
+
|
6
|
+
## パラメータ
|
7
|
+
|
8
|
+
- **module**: 実行する Python モジュール名(必須)
|
9
|
+
- **input-params**: (任意)Python モジュールに渡す入力パラメータ(キー・バリューのオブジェクト)
|
10
|
+
|
11
|
+
## 使用例
|
12
|
+
|
13
|
+
```json
|
14
|
+
{
|
15
|
+
"task": "pyrun-execute",
|
16
|
+
"connection": "my-pyrun",
|
17
|
+
"params": {
|
18
|
+
"module": "hello_world",
|
19
|
+
"input": {
|
20
|
+
"name": "山田太郎",
|
21
|
+
"count": 3
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
```
|
26
|
+
|
27
|
+
## 実行結果
|
28
|
+
|
29
|
+
- 正常に実行されると、Python モジュールの実行結果(result)が返されます。
|
30
|
+
- 実行中の標準出力(stdout)はログに記録され、標準エラー(stderr)が発生した場合はエラーとして処理されます。
|
31
|
+
- exit_code が 0 でない場合、タスクは失敗とみなされエラーが発生します。
|
32
|
+
|
33
|
+
## 注意事項
|
34
|
+
|
35
|
+
- pyrun-connector の認証設定(token または username/password)が必要な場合があります。
|
36
|
+
- 入力パラメータは `input` オブジェクトとして Python モジュールに渡されます。
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# pyrun-execute
|
2
|
+
|
3
|
+
pyrun-connector를 통해 Python Runner(pyrun) 서버의 REST API(`/api/run/{module}`)를 호출하여
|
4
|
+
지정한 파이썬 모듈을 실행하고, 실행 결과를 반환하는 태스크입니다.
|
5
|
+
|
6
|
+
## parameters
|
7
|
+
|
8
|
+
- **module**: 실행할 파이썬 모듈명 (필수)
|
9
|
+
- **input-params**: (선택) 파이썬 모듈에 전달할 입력 파라미터(키-값 쌍, 오브젝트)
|
10
|
+
|
11
|
+
## 사용 예시
|
12
|
+
|
13
|
+
```json
|
14
|
+
{
|
15
|
+
"task": "pyrun-execute",
|
16
|
+
"connection": "my-pyrun",
|
17
|
+
"params": {
|
18
|
+
"module": "hello_world",
|
19
|
+
"input": {
|
20
|
+
"name": "홍길동",
|
21
|
+
"count": 3
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
```
|
26
|
+
|
27
|
+
## 실행 결과
|
28
|
+
|
29
|
+
- 정상적으로 실행되면, 파이썬 모듈의 실행 결과(result)가 반환됩니다.
|
30
|
+
- 실행 중 표준 출력(stdout)은 로그로 기록되며, 표준 에러(stderr) 발생 시 에러로 처리됩니다.
|
31
|
+
- exit_code가 0이 아니면 태스크가 실패로 간주되어 에러가 발생합니다.
|
32
|
+
|
33
|
+
## 참고
|
34
|
+
|
35
|
+
- pyrun-connector의 인증 설정(token 또는 username/password)이 필요할 수 있습니다.
|
36
|
+
- 입력 파라미터는 파이썬 모듈에서 `input` 오브젝트로 전달됩니다.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# pyrun-execute
|
2
|
+
|
3
|
+
This task calls the Python Runner (pyrun) server's REST API (`/api/run/{module}`) via pyrun-connector,
|
4
|
+
executes the specified Python module, and returns the result.
|
5
|
+
|
6
|
+
## parameters
|
7
|
+
|
8
|
+
- **module**: Name of the Python module to execute (required)
|
9
|
+
- **input-params**: (Optional) Input parameters (key-value object) to pass to the Python module
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```json
|
14
|
+
{
|
15
|
+
"task": "pyrun-execute",
|
16
|
+
"connection": "my-pyrun",
|
17
|
+
"params": {
|
18
|
+
"module": "hello_world",
|
19
|
+
"input": {
|
20
|
+
"name": "John Doe",
|
21
|
+
"count": 3
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
```
|
26
|
+
|
27
|
+
## Result
|
28
|
+
|
29
|
+
- If successful, returns the result of the Python module execution.
|
30
|
+
- Standard output (stdout) is logged, and standard error (stderr) is treated as an error.
|
31
|
+
- If exit_code is not 0, the task is considered failed and an error is thrown.
|
32
|
+
|
33
|
+
## Notes
|
34
|
+
|
35
|
+
- pyrun-connector authentication (token or username/password) may be required.
|
36
|
+
- The input parameters are passed as the `input` object to the Python module.
|