@emqx/shared-ui-i18n 0.0.1
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/index.d.ts +1 -0
- package/dist/index.js +174 -0
- package/dist/index.umd.cjs +28 -0
- package/dist/sqlTemplate.d.ts +172 -0
- package/package.json +33 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sqlTemplate';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
const e = [
|
|
2
|
+
{
|
|
3
|
+
title: {
|
|
4
|
+
zh: "选择指定主题的消息",
|
|
5
|
+
en: "Select messages from a topic."
|
|
6
|
+
},
|
|
7
|
+
scene: {
|
|
8
|
+
zh: "使用 SQL 选择特定主题,将命中主题的消息载荷筛选出来,可以使用通配符。",
|
|
9
|
+
en: "Use SQL to select a topic, filter out the message payloads that match the topic, and support topic wildcards."
|
|
10
|
+
},
|
|
11
|
+
sql: `SELECT
|
|
12
|
+
payload as p
|
|
13
|
+
FROM
|
|
14
|
+
"t/#"`,
|
|
15
|
+
input: {
|
|
16
|
+
msg: "hello"
|
|
17
|
+
},
|
|
18
|
+
outputs: {
|
|
19
|
+
p: '{"msg": "hello"}'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: {
|
|
24
|
+
zh: "同时处理客户端连接、断开连接事件",
|
|
25
|
+
en: "Handle client connected and disconnect events in one SQL"
|
|
26
|
+
},
|
|
27
|
+
scene: {
|
|
28
|
+
zh: "在一个 SQL 中处理多个主题/事件,避免重复创建规则。",
|
|
29
|
+
en: "Simultaneous selection of multiple topics/events in one SQL, no need to repeatedly create rules."
|
|
30
|
+
},
|
|
31
|
+
sql: `SELECT
|
|
32
|
+
*
|
|
33
|
+
FROM
|
|
34
|
+
"$events/client_connected",
|
|
35
|
+
"$events/client_disconnected"`,
|
|
36
|
+
input: {},
|
|
37
|
+
outputs: {
|
|
38
|
+
username: "u_emqx",
|
|
39
|
+
timestamp: 1648870886819,
|
|
40
|
+
sockname: "0.0.0.0:1883",
|
|
41
|
+
reason: "normal",
|
|
42
|
+
proto_ver: 5,
|
|
43
|
+
proto_name: "MQTT",
|
|
44
|
+
"...": ""
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: {
|
|
49
|
+
zh: "FOREACH 处理 JSON 数组并逐个输出",
|
|
50
|
+
en: "FOREACH - Process JSON arrays and output one by one"
|
|
51
|
+
},
|
|
52
|
+
scene: {
|
|
53
|
+
zh: "数据类型为数组时,处理数组中的元素并逐个输出。",
|
|
54
|
+
en: "When the data type is an array, process the data in the array and output one by one."
|
|
55
|
+
},
|
|
56
|
+
sql: `FOREACH
|
|
57
|
+
payload.sensors
|
|
58
|
+
FROM
|
|
59
|
+
"t/#"`,
|
|
60
|
+
input: {
|
|
61
|
+
date: "2020-04-24",
|
|
62
|
+
sensors: [
|
|
63
|
+
{ name: "a", idx: 0 },
|
|
64
|
+
{ name: "b", idx: 1 },
|
|
65
|
+
{ name: "c", idx: 2 }
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
outputs: [
|
|
69
|
+
{
|
|
70
|
+
item: {
|
|
71
|
+
name: "a",
|
|
72
|
+
idx: 0
|
|
73
|
+
},
|
|
74
|
+
"...": ""
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
item: {
|
|
78
|
+
name: "b",
|
|
79
|
+
idx: 1
|
|
80
|
+
},
|
|
81
|
+
"...": ""
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
item: {
|
|
85
|
+
name: "c",
|
|
86
|
+
idx: 2
|
|
87
|
+
},
|
|
88
|
+
"...": ""
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: {
|
|
94
|
+
zh: "FOREACH 处理 JSON 数组选择指定字段并添加过滤条件",
|
|
95
|
+
en: "FOREACH - Process JSON arrays select specified fields and add filter conditions"
|
|
96
|
+
},
|
|
97
|
+
scene: {
|
|
98
|
+
zh: "数据类型为数组时,遍历数组中的数据,选择需要的字段并添加过滤条件逐个输出。",
|
|
99
|
+
en: "When the data type is an array, traverse the array to select the required fields and add filter conditions to output one by one."
|
|
100
|
+
},
|
|
101
|
+
sql: `FOREACH
|
|
102
|
+
payload.sensors
|
|
103
|
+
DO
|
|
104
|
+
clientid,
|
|
105
|
+
item.name as name,
|
|
106
|
+
item.idx as idx
|
|
107
|
+
INCASE
|
|
108
|
+
item.idx >= 1
|
|
109
|
+
FROM "t/#"`,
|
|
110
|
+
input: {
|
|
111
|
+
date: "2020-04-24",
|
|
112
|
+
sensors: [
|
|
113
|
+
{ name: "a", idx: 0 },
|
|
114
|
+
{ name: "b", idx: 1 },
|
|
115
|
+
{ name: "c", idx: 2 }
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
outputs: [
|
|
119
|
+
{
|
|
120
|
+
name: "b",
|
|
121
|
+
idx: 1,
|
|
122
|
+
clientid: "c_emqx"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "c",
|
|
126
|
+
idx: 2,
|
|
127
|
+
clientid: "c_emqx"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
title: {
|
|
133
|
+
zh: "CASE-WHEN 从多个条件列表返回可能结果",
|
|
134
|
+
en: "CASE-WHEN - Return possible results from multiple lists of conditions"
|
|
135
|
+
},
|
|
136
|
+
scene: {
|
|
137
|
+
zh: "设定多个计算条件,输出不同结果。",
|
|
138
|
+
en: "Set multiple calculation conditions and output different results."
|
|
139
|
+
},
|
|
140
|
+
sql: `SELECT
|
|
141
|
+
CASE WHEN payload.x < 0 THEN 0
|
|
142
|
+
WHEN payload.x > 7 THEN 7
|
|
143
|
+
ELSE payload.x
|
|
144
|
+
END as x
|
|
145
|
+
FROM
|
|
146
|
+
"t/#"`,
|
|
147
|
+
input: { x: 8 },
|
|
148
|
+
outputs: { x: 7 }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
title: {
|
|
152
|
+
zh: "数组处理 - 从 JSON 格式的 payload 中获取嵌套的值",
|
|
153
|
+
en: "Array - Get nested values from JSON-formatted payload"
|
|
154
|
+
},
|
|
155
|
+
scene: {
|
|
156
|
+
zh: "处理 JSON 格式的 payload,从嵌套格式中获取所需要的值。",
|
|
157
|
+
en: "Process JSON-formatted payload and get the values needed from the nested format."
|
|
158
|
+
},
|
|
159
|
+
sql: `SELECT
|
|
160
|
+
payload.data[1].id as id
|
|
161
|
+
FROM
|
|
162
|
+
"t/#"`,
|
|
163
|
+
input: {
|
|
164
|
+
data: [
|
|
165
|
+
{ id: 1, name: "steve" },
|
|
166
|
+
{ id: 2, name: "bill" }
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
outputs: { id: 1 }
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
export {
|
|
173
|
+
e as sqlTemplate
|
|
174
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e["@emqx/shared-ui-i18n"]={}))})(this,function(e){"use strict";const t=[{title:{zh:"选择指定主题的消息",en:"Select messages from a topic."},scene:{zh:"使用 SQL 选择特定主题,将命中主题的消息载荷筛选出来,可以使用通配符。",en:"Use SQL to select a topic, filter out the message payloads that match the topic, and support topic wildcards."},sql:`SELECT
|
|
2
|
+
payload as p
|
|
3
|
+
FROM
|
|
4
|
+
"t/#"`,input:{msg:"hello"},outputs:{p:'{"msg": "hello"}'}},{title:{zh:"同时处理客户端连接、断开连接事件",en:"Handle client connected and disconnect events in one SQL"},scene:{zh:"在一个 SQL 中处理多个主题/事件,避免重复创建规则。",en:"Simultaneous selection of multiple topics/events in one SQL, no need to repeatedly create rules."},sql:`SELECT
|
|
5
|
+
*
|
|
6
|
+
FROM
|
|
7
|
+
"$events/client_connected",
|
|
8
|
+
"$events/client_disconnected"`,input:{},outputs:{username:"u_emqx",timestamp:1648870886819,sockname:"0.0.0.0:1883",reason:"normal",proto_ver:5,proto_name:"MQTT","...":""}},{title:{zh:"FOREACH 处理 JSON 数组并逐个输出",en:"FOREACH - Process JSON arrays and output one by one"},scene:{zh:"数据类型为数组时,处理数组中的元素并逐个输出。",en:"When the data type is an array, process the data in the array and output one by one."},sql:`FOREACH
|
|
9
|
+
payload.sensors
|
|
10
|
+
FROM
|
|
11
|
+
"t/#"`,input:{date:"2020-04-24",sensors:[{name:"a",idx:0},{name:"b",idx:1},{name:"c",idx:2}]},outputs:[{item:{name:"a",idx:0},"...":""},{item:{name:"b",idx:1},"...":""},{item:{name:"c",idx:2},"...":""}]},{title:{zh:"FOREACH 处理 JSON 数组选择指定字段并添加过滤条件",en:"FOREACH - Process JSON arrays select specified fields and add filter conditions"},scene:{zh:"数据类型为数组时,遍历数组中的数据,选择需要的字段并添加过滤条件逐个输出。",en:"When the data type is an array, traverse the array to select the required fields and add filter conditions to output one by one."},sql:`FOREACH
|
|
12
|
+
payload.sensors
|
|
13
|
+
DO
|
|
14
|
+
clientid,
|
|
15
|
+
item.name as name,
|
|
16
|
+
item.idx as idx
|
|
17
|
+
INCASE
|
|
18
|
+
item.idx >= 1
|
|
19
|
+
FROM "t/#"`,input:{date:"2020-04-24",sensors:[{name:"a",idx:0},{name:"b",idx:1},{name:"c",idx:2}]},outputs:[{name:"b",idx:1,clientid:"c_emqx"},{name:"c",idx:2,clientid:"c_emqx"}]},{title:{zh:"CASE-WHEN 从多个条件列表返回可能结果",en:"CASE-WHEN - Return possible results from multiple lists of conditions"},scene:{zh:"设定多个计算条件,输出不同结果。",en:"Set multiple calculation conditions and output different results."},sql:`SELECT
|
|
20
|
+
CASE WHEN payload.x < 0 THEN 0
|
|
21
|
+
WHEN payload.x > 7 THEN 7
|
|
22
|
+
ELSE payload.x
|
|
23
|
+
END as x
|
|
24
|
+
FROM
|
|
25
|
+
"t/#"`,input:{x:8},outputs:{x:7}},{title:{zh:"数组处理 - 从 JSON 格式的 payload 中获取嵌套的值",en:"Array - Get nested values from JSON-formatted payload"},scene:{zh:"处理 JSON 格式的 payload,从嵌套格式中获取所需要的值。",en:"Process JSON-formatted payload and get the values needed from the nested format."},sql:`SELECT
|
|
26
|
+
payload.data[1].id as id
|
|
27
|
+
FROM
|
|
28
|
+
"t/#"`,input:{data:[{id:1,name:"steve"},{id:2,name:"bill"}]},outputs:{id:1}}];e.sqlTemplate=t,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export declare const sqlTemplate: ({
|
|
2
|
+
title: {
|
|
3
|
+
zh: string;
|
|
4
|
+
en: string;
|
|
5
|
+
};
|
|
6
|
+
scene: {
|
|
7
|
+
zh: string;
|
|
8
|
+
en: string;
|
|
9
|
+
};
|
|
10
|
+
sql: string;
|
|
11
|
+
input: {
|
|
12
|
+
msg: string;
|
|
13
|
+
date?: undefined;
|
|
14
|
+
sensors?: undefined;
|
|
15
|
+
x?: undefined;
|
|
16
|
+
data?: undefined;
|
|
17
|
+
};
|
|
18
|
+
outputs: {
|
|
19
|
+
p: string;
|
|
20
|
+
username?: undefined;
|
|
21
|
+
timestamp?: undefined;
|
|
22
|
+
sockname?: undefined;
|
|
23
|
+
reason?: undefined;
|
|
24
|
+
proto_ver?: undefined;
|
|
25
|
+
proto_name?: undefined;
|
|
26
|
+
'...'?: undefined;
|
|
27
|
+
x?: undefined;
|
|
28
|
+
id?: undefined;
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
title: {
|
|
32
|
+
zh: string;
|
|
33
|
+
en: string;
|
|
34
|
+
};
|
|
35
|
+
scene: {
|
|
36
|
+
zh: string;
|
|
37
|
+
en: string;
|
|
38
|
+
};
|
|
39
|
+
sql: string;
|
|
40
|
+
input: {
|
|
41
|
+
msg?: undefined;
|
|
42
|
+
date?: undefined;
|
|
43
|
+
sensors?: undefined;
|
|
44
|
+
x?: undefined;
|
|
45
|
+
data?: undefined;
|
|
46
|
+
};
|
|
47
|
+
outputs: {
|
|
48
|
+
username: string;
|
|
49
|
+
timestamp: number;
|
|
50
|
+
sockname: string;
|
|
51
|
+
reason: string;
|
|
52
|
+
proto_ver: number;
|
|
53
|
+
proto_name: string;
|
|
54
|
+
'...': string;
|
|
55
|
+
p?: undefined;
|
|
56
|
+
x?: undefined;
|
|
57
|
+
id?: undefined;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
title: {
|
|
61
|
+
zh: string;
|
|
62
|
+
en: string;
|
|
63
|
+
};
|
|
64
|
+
scene: {
|
|
65
|
+
zh: string;
|
|
66
|
+
en: string;
|
|
67
|
+
};
|
|
68
|
+
sql: string;
|
|
69
|
+
input: {
|
|
70
|
+
date: string;
|
|
71
|
+
sensors: {
|
|
72
|
+
name: string;
|
|
73
|
+
idx: number;
|
|
74
|
+
}[];
|
|
75
|
+
msg?: undefined;
|
|
76
|
+
x?: undefined;
|
|
77
|
+
data?: undefined;
|
|
78
|
+
};
|
|
79
|
+
outputs: {
|
|
80
|
+
item: {
|
|
81
|
+
name: string;
|
|
82
|
+
idx: number;
|
|
83
|
+
};
|
|
84
|
+
'...': string;
|
|
85
|
+
}[];
|
|
86
|
+
} | {
|
|
87
|
+
title: {
|
|
88
|
+
zh: string;
|
|
89
|
+
en: string;
|
|
90
|
+
};
|
|
91
|
+
scene: {
|
|
92
|
+
zh: string;
|
|
93
|
+
en: string;
|
|
94
|
+
};
|
|
95
|
+
sql: string;
|
|
96
|
+
input: {
|
|
97
|
+
date: string;
|
|
98
|
+
sensors: {
|
|
99
|
+
name: string;
|
|
100
|
+
idx: number;
|
|
101
|
+
}[];
|
|
102
|
+
msg?: undefined;
|
|
103
|
+
x?: undefined;
|
|
104
|
+
data?: undefined;
|
|
105
|
+
};
|
|
106
|
+
outputs: {
|
|
107
|
+
name: string;
|
|
108
|
+
idx: number;
|
|
109
|
+
clientid: string;
|
|
110
|
+
}[];
|
|
111
|
+
} | {
|
|
112
|
+
title: {
|
|
113
|
+
zh: string;
|
|
114
|
+
en: string;
|
|
115
|
+
};
|
|
116
|
+
scene: {
|
|
117
|
+
zh: string;
|
|
118
|
+
en: string;
|
|
119
|
+
};
|
|
120
|
+
sql: string;
|
|
121
|
+
input: {
|
|
122
|
+
x: number;
|
|
123
|
+
msg?: undefined;
|
|
124
|
+
date?: undefined;
|
|
125
|
+
sensors?: undefined;
|
|
126
|
+
data?: undefined;
|
|
127
|
+
};
|
|
128
|
+
outputs: {
|
|
129
|
+
x: number;
|
|
130
|
+
p?: undefined;
|
|
131
|
+
username?: undefined;
|
|
132
|
+
timestamp?: undefined;
|
|
133
|
+
sockname?: undefined;
|
|
134
|
+
reason?: undefined;
|
|
135
|
+
proto_ver?: undefined;
|
|
136
|
+
proto_name?: undefined;
|
|
137
|
+
'...'?: undefined;
|
|
138
|
+
id?: undefined;
|
|
139
|
+
};
|
|
140
|
+
} | {
|
|
141
|
+
title: {
|
|
142
|
+
zh: string;
|
|
143
|
+
en: string;
|
|
144
|
+
};
|
|
145
|
+
scene: {
|
|
146
|
+
zh: string;
|
|
147
|
+
en: string;
|
|
148
|
+
};
|
|
149
|
+
sql: string;
|
|
150
|
+
input: {
|
|
151
|
+
data: {
|
|
152
|
+
id: number;
|
|
153
|
+
name: string;
|
|
154
|
+
}[];
|
|
155
|
+
msg?: undefined;
|
|
156
|
+
date?: undefined;
|
|
157
|
+
sensors?: undefined;
|
|
158
|
+
x?: undefined;
|
|
159
|
+
};
|
|
160
|
+
outputs: {
|
|
161
|
+
id: number;
|
|
162
|
+
p?: undefined;
|
|
163
|
+
username?: undefined;
|
|
164
|
+
timestamp?: undefined;
|
|
165
|
+
sockname?: undefined;
|
|
166
|
+
reason?: undefined;
|
|
167
|
+
proto_ver?: undefined;
|
|
168
|
+
proto_name?: undefined;
|
|
169
|
+
'...'?: undefined;
|
|
170
|
+
x?: undefined;
|
|
171
|
+
};
|
|
172
|
+
})[];
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@emqx/shared-ui-i18n",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"homepage": "https://emqx.io",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/emqx/shared-ui"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"main": "./dist/index.umd.cjs",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"require": "./dist/index.umd.cjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"dev": "vite",
|
|
28
|
+
"build": "tsc && vite build",
|
|
29
|
+
"preview": "vite preview",
|
|
30
|
+
"test": "vitest run --coverage",
|
|
31
|
+
"publish": "npm publish"
|
|
32
|
+
}
|
|
33
|
+
}
|