index.ts 1.64 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.CUSTOMER_DETAILS);

export interface CustomerDetailsDataType {
  someConfiguration?: Recordable;
}

export const CustomerDetailsConfig: NodeItemConfigType = {
  ...keys,
  clazz: 'org.thingsboard.rule.engine.metadata.TbGetCustomerDetailsNode',
  categoryType: RuleNodeTypeEnum.ENRICHMENT,
  name: 'customer details',
  configurationDescriptor: {
    nodeDefinition: {
      details:
        'If checkbox: <b>Add selected details to the message metadata</b> is selected, existing fields will be added to the message metadata instead of message data.<br><br><b>Note:</b> only Device, Asset, and Entity View type are allowed.<br><br>If the originator of the message is not assigned to Customer, or originator type is not supported - Message will be forwarded to <b>Failure</b> chain, otherwise, <b>Success</b> chain will be used.',
      description: 'Adds fields from Customer details to the message body or metadata',
      inEnabled: true,
      outEnabled: true,
      relationTypes: ['Success', 'Failure'],
      customRelations: false,
      ruleChainNode: false,
      defaultConfiguration: {
        detailsList: [],
        addToMetadata: false,
      },
      uiResources: ['static/rulenode/rulenode-core-config.js'],
      configDirective: 'tbEnrichmentNodeEntityDetailsConfig',
      icon: '',
      iconUrl: '',
      docUrl: '',
    },
  },
};