@foxglove/extension 2.29.1 → 2.30.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/stable.ts +45 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxglove/extension",
3
- "version": "2.29.1",
3
+ "version": "2.30.1",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Foxglove Technologies",
package/src/stable.ts CHANGED
@@ -932,7 +932,21 @@ export type RegisterMessageConverterArgsTopic = {
932
932
  type: "topic";
933
933
  inputTopics: string[];
934
934
  outputTopic: string;
935
- schemaName: string;
935
+
936
+ /** Name of the schema for messages output by the converter.
937
+ *
938
+ * If you output well-known messages like a foxglove CompressedImage then your schema name would
939
+ * be `foxglove.CompressedImage`.
940
+ *
941
+ * If you are creating a new custom schema you can assign any name. Avoid picking an existing name
942
+ * if your data uses a different schema.
943
+ *
944
+ * NOTE: For ROS users, we also support names like `sensor_msgs/msg/CompressedImage`. See the
945
+ * supported messages documentation for each panel to learn what kinds of schemas it can display.
946
+ *
947
+ */
948
+ outputSchemaName: string;
949
+
936
950
  /**
937
951
  * Describes the structure of the output messages produced by this converter.
938
952
  *
@@ -978,11 +992,38 @@ export type RegisterMessageConverterArgsTopic = {
978
992
  * }
979
993
  * ```
980
994
  */
995
+ outputSchemaDescription?: MessageSchemaDescription;
996
+
997
+ /** @deprecated use `outputSchemaName` instead */
998
+ schemaName?: string;
999
+
1000
+ /** @deprecated use `outputSchemaDescription` instead */
981
1001
  schemaDescription?: MessageSchemaDescription;
1002
+
1003
+ /**
1004
+ *
1005
+ * The create function initializes the converter. It is called by the app to create the converter
1006
+ * when some panel subscribes to the output topic.
1007
+ *
1008
+ * ```
1009
+ * create: () => {
1010
+ * return (msgEvent: MessageEvent) => {
1011
+ * const msg = msgEvent.message as MySignal;
1012
+ * return { value: Math.abs(msg.acceleration) };
1013
+ * };
1014
+ * },
1015
+ * ```
1016
+ *
1017
+ * @returns A function that is called with a MessageEvent for every input message. It performs any
1018
+ * computation and returns a new message(s) matching the schema description. The function can
1019
+ * optionally return undefined to skip producing message(s) for the given input.
1020
+ */
982
1021
  create: () => TopicConverterReturnType;
983
1022
  };
984
1023
 
985
- type TopicConverterReturnType = (messageEvent: Immutable<MessageEvent>) => unknown;
1024
+ type TopicConverterReturnType = (
1025
+ messageEvent: Immutable<MessageEvent>,
1026
+ ) => undefined | Record<string, unknown> | Record<string, unknown>[];
986
1027
 
987
1028
  /**
988
1029
  * This type represents the arguments you pass to
@@ -996,8 +1037,8 @@ type TopicConverterReturnType = (messageEvent: Immutable<MessageEvent>) => unkno
996
1037
  * messages for visualization in the [Map
997
1038
  * panel](https://docs.foxglove.dev/docs/visualization/panels/map).
998
1039
  *
999
- * See the [Creating a message
1000
- * converter](https://docs.foxglove.dev/docs/visualization/extensions/guides/create-message-converter)
1040
+ * See the [Creating a topic
1041
+ * converter](https://docs.foxglove.dev/docs/visualization/extensions/guides/create-topic-converter)
1001
1042
  * guide for more details.
1002
1043
  *
1003
1044
  * @category Message converters