index.ts 1.73 KB
import { ExternalCategoryComponentEnum } from '../../../enum/category';
import { useCreateNodeKey } from '../../../hook/useCreateNodeKey';
import type { NodeItemConfigType } from '../../../types/node';
import { RuleNodeTypeEnum } from '../../index.type';
import { useI18n } from '/@/hooks/web/useI18n';

const keys = useCreateNodeKey(ExternalCategoryComponentEnum.AZURE_IOT_HUB);

const { t } = useI18n(); // 加载国际化
export interface AzureIotHubDataType {
  someConfiguration?: Recordable;
}

export const AzureIotHubConfig: NodeItemConfigType = {
  ...keys,
  clazz: 'org.thingsboard.rule.engine.mqtt.azure.TbAzureIotHubNode',
  categoryType: RuleNodeTypeEnum.EXTERNAL,
  name: t('designer_config.externals.index.azureIotHub.name'),
  configurationDescriptor: {
    nodeDefinition: {
      details: t('designer_config.externals.index.azureIotHub.details'),
      description: t('designer_config.externals.index.azureIotHub.description'),
      inEnabled: true,
      outEnabled: true,
      relationTypes: ['Success', 'Failure'],
      customRelations: false,
      ruleChainNode: false,
      defaultConfiguration: {
        topicPattern: 'devices/<device_id>/messages/events/',
        host: '<iot-hub-name>.azure-devices.net',
        port: 8883,
        connectTimeoutSec: 10,
        clientId: null,
        appendClientIdSuffix: false,
        cleanSession: true,
        ssl: true,
        credentials: {
          type: 'sas',
          caCert: null,
          cert: null,
          privateKey: null,
          password: null,
          sasKey: null,
        },
      },
      uiResources: ['static/rulenode/rulenode-core-config.js'],
      configDirective: 'tbActionNodeAzureIotHubConfig',
      icon: '',
      iconUrl: '',
      docUrl: '',
    },
  },
};