index.ts 2.28 KB
import { EnrichmentCategoryComponentEnum } from '../../../enum/category';
import { useCreateNodeKey } from '../../../hook/useCreateNodeKey';
import type { NodeItemConfigType } from '../../../types/node';
import { RuleNodeTypeEnum } from '../../index.type';

const keys = useCreateNodeKey(EnrichmentCategoryComponentEnum.ORIGINATOR_TELEMETRY);

export interface OriginatorTelemetryDataType {
  someConfiguration?: Recordable;
}

export const OriginatorTelemetryConfig: NodeItemConfigType = {
  ...keys,
  clazz: 'org.thingsboard.rule.engine.metadata.TbGetTelemetryNode',
  categoryType: RuleNodeTypeEnum.ENRICHMENT,
  name: 'originator telemetry',
  configurationDescriptor: {
    nodeDefinition: {
      details:
        'The node allows you to select fetch mode: <b>FIRST/LAST/ALL</b> to fetch telemetry of certain time range that are added into Message metadata without any prefix. If selected fetch mode <b>ALL</b> Telemetry will be added like array into Message Metadata where <b>key</b> is Timestamp and <b>value</b> is value of Telemetry.</br>If selected fetch mode <b>FIRST</b> or <b>LAST</b> Telemetry will be added like string without Timestamp.</br>Also, the rule node allows you to select telemetry sampling order: <b>ASC</b> or <b>DESC</b>. </br>Aggregation feature allows you to fetch aggregated telemetry as a single value by <b>AVG, COUNT, SUM, MIN, MAX, NONE</b>. </br><b>Note</b>: The maximum size of the fetched array is 1000 records.\n ',
      description:
        'Add Message Originator Telemetry for selected time range into Message Metadata\n',
      inEnabled: true,
      outEnabled: true,
      relationTypes: ['Success', 'Failure'],
      customRelations: false,
      ruleChainNode: false,
      defaultConfiguration: {
        startInterval: 2,
        endInterval: 1,
        startIntervalPattern: '',
        endIntervalPattern: '',
        useMetadataIntervalPatterns: false,
        startIntervalTimeUnit: 'MINUTES',
        endIntervalTimeUnit: 'MINUTES',
        fetchMode: 'FIRST',
        orderBy: 'ASC',
        aggregation: 'NONE',
        limit: 1000,
        latestTsKeyNames: [],
      },
      uiResources: ['static/rulenode/rulenode-core-config.js'],
      configDirective: 'tbEnrichmentNodeGetTelemetryFromDatabase',
      icon: '',
      iconUrl: '',
      docUrl: '',
    },
  },
};