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

const keys = useCreateNodeKey(ActionCategoryComponentEnum.ASSIGN_TO_CUSTOMER);

export interface AssignToCustomerDataType {
  someConfiguration?: Recordable;
}

export const AssignToCustomerConfig: NodeItemConfigType = {
  ...keys,
  clazz: 'org.thingsboard.rule.engine.action.TbAssignToCustomerNode',
  categoryType: RuleNodeTypeEnum.ACTION,
  name: 'assign to customer',
  configurationDescriptor: {
    nodeDefinition: {
      details:
        "Finds target Customer by customer name pattern and then assign Originator Entity to this customer. Will create new Customer if it doesn't exists and 'Create new Customer if not exists' is set to true.",
      description: 'Assign Message Originator Entity to Customer',
      inEnabled: true,
      outEnabled: true,
      relationTypes: ['Success', 'Failure'],
      customRelations: false,
      ruleChainNode: false,
      defaultConfiguration: {
        customerNamePattern: '',
        customerCacheExpiration: 300,
        createCustomerIfNotExists: false,
      },
      uiResources: ['static/rulenode/rulenode-core-config.js'],
      configDirective: 'tbActionNodeAssignToCustomerConfig',
      icon: 'ic:baseline-add-circle',
      iconUrl: '',
      docUrl: '',
    },
  },
};