Browse Source

meta: update function plugin meta

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 2 years ago
parent
commit
9d6ed607f1

+ 7 - 9
extensions/functions/accumulateWordCount/accumulateWordCount.json

@@ -43,17 +43,15 @@
 				"values": []
 				"values": []
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "accumulateWordCount"
+		"return": {
+			"type": "int",
+			"hint": {
+				"en_US": "Count",
+				"zh_CN": "计数值"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "AccumulateWordCount",
 				"en_US": "AccumulateWordCount",

+ 8 - 9
extensions/functions/countPlusOne/countPlusOne.json

@@ -20,6 +20,7 @@
 	"functions": [{
 	"functions": [{
 		"name": "countPlusOne",
 		"name": "countPlusOne",
 		"example": "countPlusOne(col1)",
 		"example": "countPlusOne(col1)",
+		"aggregate": true,
 		"hint": {
 		"hint": {
 			"en_US": "The value of the output parameter length plus one",
 			"en_US": "The value of the output parameter length plus one",
 			"zh_CN": "输出参数长度加一的值"
 			"zh_CN": "输出参数长度加一的值"
@@ -41,17 +42,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "countPlusOne"
+		"return": {
+			"type": "int",
+			"hint": {
+				"en_US": "Count",
+				"zh_CN": "计数值"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "countPlusOne",
 				"en_US": "countPlusOne",

+ 15 - 18
extensions/functions/echo/echo.json

@@ -26,36 +26,33 @@
 		},
 		},
 		"args": [
 		"args": [
 			{
 			{
-				"name": "inputData",
-				"hidden": true,
+				"name": "field",
 				"optional": false,
 				"optional": false,
-				"control": "text",
+				"control": "field",
 				"type": "string",
 				"type": "string",
 				"hint": {
 				"hint": {
-					"en_US": "Input data",
-					"zh_CN": "输入数据"
+					"en_US": "The field to echo.",
+					"zh_CN": "字段名"
 				},
 				},
 				"label": {
 				"label": {
-					"en_US": "Input data",
-					"zh_CN": "输入数据"
+					"en_US": "Field",
+					"zh_CN": "字段"
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "echo"
+		"return": {
+			"type": "string",
+			"hint": {
+				"en_US": "Echoed string",
+				"zh_CN": "回声值"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
-				"en_US": "countPlusOne",
-				"zh_CN": "countPlusOne"
+				"en_US": "Echo",
+				"zh_CN": "回声"
 			}
 			}
 		}
 		}
 	}]
 	}]

+ 86 - 103
extensions/functions/geohash/geohash.json

@@ -57,17 +57,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashEncode"
+		"return": {
+			"type": "int",
+			"hint": {
+				"en_US": "Encoded string",
+				"zh_CN": "编码字符"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashEncode",
 				"en_US": "geohashEncode",
@@ -113,17 +111,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashEncodeInt"
+		"return": {
+			"type": "int",
+			"hint": {
+				"en_US": "Encoded value",
+				"zh_CN": "编码值"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashEncodeInt",
 				"en_US": "geohashEncodeInt",
@@ -154,17 +150,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashDecode"
+		"return": {
+			"type": "struct",
+			"hint": {
+				"en_US": "Decoded Value",
+				"zh_CN": "解码值"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashDecode",
 				"en_US": "geohashDecode",
@@ -195,17 +189,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashDecodeInt"
+		"return": {
+			"type": "struct",
+			"hint": {
+				"en_US": "Decoded Value",
+				"zh_CN": "解码值"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashDecodeInt",
 				"en_US": "geohashDecodeInt",
@@ -236,17 +228,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashBoundingBox"
+		"return": {
+			"type": "struct",
+			"hint": {
+				"en_US": "Box",
+				"zh_CN": "区域"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashBoundingBox",
 				"en_US": "geohashBoundingBox",
@@ -277,17 +267,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashBoundingBoxInt"
+		"return": {
+			"type": "int",
+			"hint": {
+				"en_US": "Bounding Box",
+				"zh_CN": "区域编码"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashBoundingBoxInt",
 				"en_US": "geohashBoundingBoxInt",
@@ -333,17 +321,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashNeighbor"
+		"return": {
+			"type": "string",
+			"hint": {
+				"en_US": "Neighbor",
+				"zh_CN": "相邻位置"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashNeighbor",
 				"en_US": "geohashNeighbor",
@@ -389,17 +375,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashNeighborInt"
+		"return": {
+			"type": "string",
+			"hint": {
+				"en_US": "Neighbor",
+				"zh_CN": "相邻位置编码"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashNeighborInt",
 				"en_US": "geohashNeighborInt",
@@ -430,17 +414,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "geohashNeighbors"
+		"return": {
+			"type": "array",
+			"hint": {
+				"en_US": "All Neighbor",
+				"zh_CN": "所有相邻位置"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "geohashNeighbors",
 				"en_US": "geohashNeighbors",
@@ -459,30 +441,31 @@
 				"hidden": true,
 				"hidden": true,
 				"optional": false,
 				"optional": false,
 				"control": "text",
 				"control": "text",
-				"type": "string",
-				"hint": {
-					"en_US": "Input data",
-					"zh_CN": "输入数据"
-				},
-				"label": {
-					"en_US": "Input data",
-					"zh_CN": "输入数据"
-				}
-			}],
-		"outputs": [{
-			"label": {
-				"en_US": "Output",
-				"zh_CN": "输出"
+			"type": "string",
+			"hint": {
+				"en_US": "Input data",
+				"zh_CN": "输入数据"
 			},
 			},
-			"value": "geohashNeighbors"
-		}],
+			"label": {
+				"en_US": "Input data",
+				"zh_CN": "输入数据"
+			}
+		}
+		],
+		"return": {
+			"type": "array",
+			"hint": {
+				"en_US": "All Neighbor",
+				"zh_CN": "所有相邻位置编码"
+			}
+		},
 		"node": {
 		"node": {
-				"category": "abc",
-				"icon": "iconPath",
-				"label": {
-					"en_US": "geohashNeighbors",
-					"zh_CN": "geohashNeighbors"
-				}
+			"category": "function",
+			"icon": "iconPath",
+			"label": {
+				"en_US": "geohashNeighbors",
+				"zh_CN": "geohashNeighbors"
 			}
 			}
+		}
 	}]
 	}]
 }
 }

+ 14 - 18
extensions/functions/image/image.json

@@ -84,17 +84,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "resize"
+		"return": {
+			"type": "bytea",
+			"hint": {
+				"en_US": "Resized image",
+				"zh_CN": "缩放后的图像"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "resize",
 				"en_US": "resize",
@@ -153,17 +151,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "thumbnail"
+		"return": {
+			"type": "bytea",
+			"hint": {
+				"en_US": "Thumbnail",
+				"zh_CN": "缩略图"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "thumbnail",
 				"en_US": "thumbnail",

+ 7 - 9
extensions/functions/labelImage/labelImage.json

@@ -42,17 +42,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "labelImage"
+		"return": {
+			"type": "string",
+			"hint": {
+				"en_US": "Image Label",
+				"zh_CN": "图像标注"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "labelImage",
 				"en_US": "labelImage",

+ 7 - 9
extensions/functions/tfLite/tfLite.json

@@ -70,17 +70,15 @@
 				}
 				}
 			}
 			}
 		],
 		],
-		"outputs": [
-			{
-				"label": {
-					"en_US": "Output",
-					"zh_CN": "输出"
-				},
-				"value": "tflite"
+		"return": {
+			"type": "array",
+			"hint": {
+				"en_US": "Inferred result",
+				"zh_CN": "推理结果"
 			}
 			}
-		],
+		},
 		"node": {
 		"node": {
-			"category": "abc",
+			"category": "function",
 			"icon": "iconPath",
 			"icon": "iconPath",
 			"label": {
 			"label": {
 				"en_US": "tflite",
 				"en_US": "tflite",

+ 1 - 10
extensions/sources/random/random.json

@@ -97,17 +97,8 @@
       }
       }
     ]
     ]
   },
   },
-  "outputs": [
-    {
-      "label": {
-        "en_US": "Output",
-        "zh_CN": "输出"
-      },
-      "value": "signal"
-    }
-  ],
   "node": {
   "node": {
-    "category": ["Protocol","Protocol1"],
+    "category": "source",
     "icon": "iconPath",
     "icon": "iconPath",
     "label": {
     "label": {
       "en_US": "Random",
       "en_US": "Random",

+ 44 - 11
sdk/go/example/mirror/functions/echo.json

@@ -8,20 +8,53 @@
 			"website": "https://www.emqx.io"
 			"website": "https://www.emqx.io"
 		},
 		},
 		"helpUrl": {
 		"helpUrl": {
-      "en_US": "https://github.com/lf-edge/ekuiper/blob/master/docs/en_US/plugins/functions/functions.md",
-      "zh_CN": "https://github.com/lf-edge/ekuiper/blob/master/docs/zh_CN/plugins/functions/functions.md"
+			"en_US": "https://ekuiper.org/docs/en/latest/sqls/custom_functions.html",
+			"zh_CN": "https://ekuiper.org/docs/zh/latest/sqls/custom_functions.html"
 		},
 		},
 		"description": {
 		"description": {
 			"en_US": "",
 			"en_US": "",
 			"zh_CN": ""
 			"zh_CN": ""
 		}
 		}
 	},
 	},
-	"functions": [{
-		"name": "echo",
-		"example": "echo(col1)",
-		"hint": {
-			"en_US": "The parameter value is output as it is.",
-			"zh_CN": "原样输出参数值。"
-		}
-	}]
-}
+	"name": "echo",
+	"functions": [
+		{
+			"name": "echo",
+			"example": "echo(col1)",
+			"hint": {
+				"en_US": "The parameter value is output as it is.",
+				"zh_CN": "原样输出参数值。"
+			},
+			"args": [
+				{
+					"name": "field",
+					"optional": false,
+					"control": "field",
+					"type": "string",
+					"hint": {
+						"en_US": "The field to echo.",
+						"zh_CN": "字段名"
+					},
+					"label": {
+						"en_US": "Field",
+						"zh_CN": "字段"
+					}
+				}
+			],
+			"return": {
+				"type": "string",
+				"hint": {
+					"en_US": "Echoed string",
+					"zh_CN": "回声值"
+				}
+			},
+			"node": {
+				"category": "function",
+				"icon": "iconPath",
+				"label": {
+					"en_US": "Echo",
+					"zh_CN": "回声"
+				}
+			}
+		}]
+}

+ 20 - 11
sdk/go/example/mirror/sinks/file.json

@@ -36,15 +36,24 @@
 		"name": "interval",
 		"name": "interval",
 		"default": 1000,
 		"default": 1000,
 		"optional": true,
 		"optional": true,
-		"control": "text",
-		"type": "int",
-		"hint": {
-			"en_US": "The time interval (ms) for writing the analysis result.",
-			"zh_CN": "写入分析结果的时间间隔(毫秒)。"
-		},
-		"label": {
-			"en_US": "Intervals",
-			"zh_CN": "间隔时间"
-		}
-	}]
+      "control": "text",
+      "type": "int",
+      "hint": {
+        "en_US": "The time interval (ms) for writing the analysis result.",
+        "zh_CN": "写入分析结果的时间间隔(毫秒)。"
+      },
+      "label": {
+        "en_US": "Intervals",
+        "zh_CN": "间隔时间"
+      }
+    }
+    ],
+  "node": {
+    "category": "Sink",
+    "icon": "iconPath",
+    "label": {
+      "en": "File",
+      "zh": "文件"
+    }
+  }
 }
 }

+ 8 - 0
sdk/go/example/mirror/sources/random.json

@@ -96,5 +96,13 @@
         }
         }
       }
       }
     ]
     ]
+  },
+  "node": {
+    "category": "source",
+    "icon": "iconPath",
+    "label": {
+      "en_US": "Random",
+      "zh_CN": "Random"
+    }
   }
   }
 }
 }

+ 31 - 0
sdk/python/example/pysam/functions/revert.json

@@ -18,6 +18,37 @@
 		"hint": {
 		"hint": {
 			"en_US": "Revert the input string",
 			"en_US": "Revert the input string",
 			"zh_CN": "输出反转参数值。"
 			"zh_CN": "输出反转参数值。"
+		},
+		"args": [
+			{
+				"name": "field",
+				"optional": false,
+				"control": "field",
+				"type": "string",
+				"hint": {
+					"en_US": "The field to revert.",
+					"zh_CN": "用于反转的字段名"
+				},
+				"label": {
+					"en_US": "Field",
+					"zh_CN": "字段"
+				}
+			}
+		],
+		"return": {
+			"type": "string",
+			"hint": {
+				"en_US": "Reverted string",
+				"zh_CN": "反转值"
+			}
+		},
+		"node": {
+			"category": "function",
+			"icon": "iconPath",
+			"label": {
+				"en_US": "Revert",
+				"zh_CN": "反转"
+			}
 		}
 		}
 	}]
 	}]
 }
 }

+ 20 - 11
sdk/python/example/pysam/sinks/print.json

@@ -1,15 +1,24 @@
 {
 {
 	"about": {
 	"about": {
 		"trial": true,
 		"trial": true,
-		"author": {
-			"name": "EMQ",
-			"email": "contact@emqx.io",
-			"company": "EMQ Technologies Co., Ltd",
-			"website": "https://www.emqx.io"
-		},
-		"description": {
-			"en_US": "Example sink plugin to print with python logger",
-			"zh_CN": "示例 python 插件,使用 python 打出日志"
-		}
-	}
+      "author": {
+        "name": "EMQ",
+        "email": "contact@emqx.io",
+        "company": "EMQ Technologies Co., Ltd",
+        "website": "https://www.emqx.io"
+      },
+      "description": {
+        "en_US": "Example sink plugin to print with python logger",
+        "zh_CN": "示例 python 插件,使用 python 打出日志"
+      }
+    },
+  "properties": [],
+  "node": {
+    "category": "sink",
+    "icon": "iconPath",
+    "label": {
+      "en": "Print",
+      "zh": "Print"
+    }
+  }
 }
 }

+ 8 - 0
sdk/python/example/pysam/sources/pyjson.json

@@ -15,5 +15,13 @@
       "en_US": "The python source will send json data.",
       "en_US": "The python source will send json data.",
       "zh_CN": "Python 源发送数据"
       "zh_CN": "Python 源发送数据"
     }
     }
+  },
+  "node": {
+    "category": "source",
+    "icon": "iconPath",
+    "label": {
+      "en_US": "Pyjson",
+      "zh_CN": "Pyjson"
+    }
   }
   }
 }
 }