iot.d.ts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. declare namespace IOT {
  2. // MQTT
  3. namespace API {
  4. namespace MODEL {
  5. type QueryPamars = {
  6. modelLabel?: string // 模型名称
  7. transportType: TransportEnum
  8. } & Partial<COMMON.QueryParams>
  9. interface Model {
  10. id: string
  11. modelLabel: string,
  12. transportType: string,
  13. payloadType: string,
  14. deviceType: string,
  15. modelDescription: string,
  16. }
  17. interface ModelDot extends Model {
  18. id: string,
  19. createAt: string,
  20. updateAt: string,
  21. deleted: boolean,
  22. tenantId: string
  23. }
  24. interface plugin {
  25. id: string
  26. 'modelId': string,
  27. 'modelPluginType': 'JS',
  28. 'modelPluginBody': string
  29. }
  30. }
  31. namespace MODELATTR {
  32. interface ModelAttr {
  33. attributeKey: string
  34. attributeLabel: string
  35. dataType: string
  36. dataUnit: string
  37. scope: string
  38. expr: string
  39. }
  40. }
  41. namespace MODELTEMPLATE {
  42. interface modelTemplate {
  43. id: string
  44. templateLabel: string
  45. templateAttribute: {
  46. id: string
  47. attributeKey: string
  48. attributeLabel: string
  49. dataType: string
  50. dataUnit: string
  51. scope: string
  52. expr: string
  53. modelId: string
  54. key: string
  55. }[]
  56. templatePlugin: any
  57. templateCmd: any
  58. }
  59. }
  60. namespace CMD {
  61. interface Cmd {
  62. id: string,
  63. 'cmdLabel': string,
  64. 'cmdParams': {
  65. id: string
  66. 'paramLabel': string,
  67. 'dataType': string,
  68. 'required': boolean,
  69. 'dataUnit': string,
  70. 'minValue': any,
  71. 'maxValue': any,
  72. 'scope': string,
  73. 'description': string
  74. }[],
  75. 'cmdResponses': {
  76. 'paramLabel': string,
  77. 'dataType': string,
  78. 'required': boolean,
  79. 'dataUnit': string,
  80. 'minValue': any,
  81. 'maxValue': any,
  82. 'scope': string,
  83. 'description': string
  84. }[],
  85. 'modelId': string
  86. }
  87. }
  88. namespace DEVICE {
  89. type QueryPamars = {
  90. page: number
  91. pageSize: number
  92. deviceStatus?: DeviceTypeEnum
  93. modelId?: string
  94. searchKey?: string
  95. searchValue?: string
  96. }
  97. type BodyParams = {
  98. modelId: string
  99. deviceCode: string
  100. deviceLabel: string
  101. deviceAuthType: string
  102. deviceSecret: string
  103. confirmSecret: string
  104. }
  105. type SubBodyParams = {
  106. gatewayId: string,
  107. modelId: string
  108. deviceCode: string
  109. deviceLabel: string
  110. }
  111. interface Device {
  112. id: string
  113. deviceLabel: string
  114. deviceCode: string
  115. deviceDescription: string
  116. modelId: string
  117. modelLabel: string
  118. deviceStatus: string
  119. deviceNodeType: string
  120. lastConnectTs: string
  121. lastActivityTs: string
  122. }
  123. interface DeviceTag {
  124. deviceId: string,
  125. tagLabel: string
  126. tagValue: string
  127. }
  128. interface Count {
  129. 'TOTAL': string,
  130. 'DISABLED': string,
  131. 'INIT': string,
  132. 'CONNECT': string,
  133. 'DISCONNECT': string
  134. }
  135. interface Msg {
  136. 'id': string,
  137. 'deviceId': string,
  138. 'status': DeviceMsgEnum, // 消息状态 值有QUEUED 队列中,SENT 已发送,DELIVERED 设备收到 SUCCESSFUL 成功 TIMEOUT 超时 FAILED 失败
  139. 'msgPayload': string,
  140. 'msgLabel': string,
  141. 'topic': string,
  142. 'msgId': number
  143. }
  144. interface Cmd {
  145. id: string
  146. 'status': DeviceMsgEnum,
  147. 'msgId': number,
  148. 'cmdLabel': string,
  149. 'cmdPayload': any // '{"method":null,"params":null}',
  150. 'deviceId': string
  151. }
  152. interface Group {
  153. 'groupLabel': string, // 分组名字
  154. 'upperGroupId': string, // 上级分组id
  155. }
  156. interface GroupQueryParams {
  157. page: number,
  158. pageSize: number,
  159. modelId?: string,
  160. searchKey?: string,
  161. deviceGroupId: string,
  162. searchValue?: string,
  163. }
  164. interface Topology {
  165. gatewayDevice: {
  166. 'id': string,
  167. 'modelLabel': string,
  168. 'deviceCode': string,
  169. 'deviceLabel': string,
  170. 'deviceDescription': string,
  171. 'modelId': string,
  172. 'deviceStatus': string,
  173. 'deviceNodeType': string,
  174. 'lastConnectTs': string,
  175. 'lastActivityTs': string,
  176. 'gatewayId': string
  177. }[],
  178. model: {
  179. 'id': string,
  180. 'modelLabel': string,
  181. 'transportType': string,
  182. 'payloadType': string,
  183. 'deviceType': string,
  184. 'modelDescription': string,
  185. }[],
  186. subDevice: {
  187. 'id': string,
  188. 'modelLabel': string,
  189. 'deviceCode': string,
  190. 'deviceLabel': string,
  191. 'deviceDescription': string,
  192. 'modelId': string,
  193. 'deviceStatus': string,
  194. 'deviceNodeType': string,
  195. 'lastConnectTs': string,
  196. 'lastActivityTs': string,
  197. 'gatewayId': string
  198. }[]
  199. }
  200. interface Session {
  201. 'id': string,
  202. 'createAt': 1683171293012,
  203. 'updateAt': string,
  204. 'deviceId': string,
  205. 'sessionType': 'CONNECT' | 'DISCONNECT',
  206. 'connectTime': string,
  207. 'activityTime': string
  208. }
  209. interface Attr {
  210. hum?: {
  211. 'deviceId':string,
  212. 'ts': string,
  213. 'key': string,
  214. 'keyLabel': string,
  215. 'stringValue': any,
  216. 'doubleValue': any,
  217. 'longValue': number,
  218. 'booleanValue': null,
  219. 'jsonValue': null,
  220. 'dataUnit': string,
  221. 'scope': null,
  222. 'dataType': string
  223. }[]
  224. [key: string]: any
  225. }
  226. }
  227. namespace EVENT {
  228. interface Event {
  229. 'id': string,
  230. 'entityId': string,
  231. 'eventName': string,
  232. 'eventPayload': string,
  233. 'eventType': string,
  234. 'eventTs': bigint,
  235. 'success': boolean
  236. }
  237. interface QueryParams {
  238. deviceId: string
  239. lastId: string
  240. startTime: string,
  241. page: string
  242. success?: boolean
  243. pageSize: string
  244. eventType: EventTypeEnum
  245. endTime: string
  246. }
  247. }
  248. namespace RULE {
  249. interface ForwardRuleQueryParams {
  250. page: number,
  251. pageSize: number,
  252. ruleLabel?: string,
  253. id: string,
  254. subjectResource: SubjectResourceEnum,
  255. subjectEvent: SubjectEventEnum,
  256. status: boolean,
  257. }
  258. interface ForwardRuleBody {
  259. subjectResource: SubjectResourceEnum,
  260. subjectEvent: SubjectEventEnum,
  261. ruleLabel: string,
  262. ruleDescription?: string,
  263. forwardRuleTargets: Array
  264. }
  265. interface ForwardRule {
  266. 'id': null,
  267. 'ruleLabel': string,
  268. 'ruleDescription': string,
  269. 'subjectResource': SubjectResourceEnum,
  270. 'subjectEvent': SubjectEventEnum,
  271. 'entityId': null,
  272. 'forwardRuleTargets': null,
  273. 'status': false
  274. }
  275. interface LinkRuleBody {
  276. ruleLabel: string
  277. ruleDescription: string
  278. conditionLogic: string
  279. conditions: Array
  280. actions: Array
  281. }
  282. interface LinkRule {
  283. 'ruleLabel': string,
  284. 'ruleDescription': string,
  285. 'conditionLogic': string,
  286. 'conditions': Array
  287. actions: Array
  288. status: boolean
  289. }
  290. }
  291. namespace DATA {
  292. interface QueryParams {
  293. page: number,
  294. pageSize: number,
  295. deviceId: string
  296. modelId: string
  297. attributeKey: string,
  298. startTime: string,
  299. endTime
  300. }
  301. interface History {
  302. 'deviceId': string,
  303. 'ts': 1681181164001,
  304. 'key': string,
  305. 'keyLabel': string,
  306. 'stringValue': string,
  307. 'doubleValue': null,
  308. 'longValue': null,
  309. 'booleanValue': null,
  310. 'jsonValue': null,
  311. 'dataUnit': null,
  312. 'scope': null
  313. }
  314. interface OpenApi {
  315. id: string
  316. 'apiUrl': string,
  317. 'apiLabel': string,
  318. 'apiDescription':string,
  319. 'apiParameters': string,
  320. 'apiParametersDescription': string,
  321. 'apiResponse': string,
  322. 'apiResponseDescription': string
  323. }
  324. }
  325. namespace DEVOPS {
  326. type statsType = 'transportSuccessCounter' | 'transportFailCounter'
  327. | 'transportTotalCounter' | 'toTransportSuccessCounter' | 'toTransportFailCounter'
  328. | 'toTransportTotalCounter'| 'transportReqSuccessCounter'| 'transportReqFailCounter'| 'transportReqTotalCounter'
  329. interface Notice {
  330. entityId: string,
  331. id: string
  332. noticeDescription: string
  333. noticeEntityId: string
  334. noticeLabel: string
  335. }
  336. }
  337. namespace TASK {
  338. interface Task {
  339. 'taskLabel': string,
  340. 'taskConfig': {
  341. cmdParameters: Record<string, any>
  342. taskType: 'DEVICE_CMD' |'DEVICE_MSG' |'DEVICE_DISCONNECT'
  343. }, // 任务配置
  344. 'status': number, // 任务状态
  345. 'taskDescription': string,
  346. 'cornDescr': string // corn 表达式
  347. }
  348. interface Statistics {
  349. 'TOTAL': number,
  350. 'DISABLE': number,
  351. 'ENABLE': number
  352. }
  353. interface TrackTask {
  354. 'id': string,
  355. 'taskId': string, // 任务id
  356. 'ts': bigint, // 执行时间
  357. 'params': null, // 任务参数
  358. 'ret': null, // 任务结果
  359. }
  360. }
  361. namespace SYS {
  362. interface Sys {
  363. 'id': string,
  364. 'sysLabel': string,
  365. 'sysIcon': string, // 系统图片,上传时候限制大小为3M 并且base64 编码
  366. 'sysTheme': string,
  367. 'mailConf': {
  368. 'host': string,
  369. 'port': number,
  370. 'protocol': string,
  371. 'username': string,
  372. 'password': string
  373. }
  374. }
  375. interface Notice {
  376. 'id': string,
  377. 'source': 0 | 1, // 通知数据来源 0 通知 1 告警
  378. 'label': string, // 通知方式名称
  379. 'notification': null, // 通知配置
  380. 'status': boolean, // 状态 true 是启用 false 是停用
  381. notification: {
  382. methodType: 'EMAIL' | 'WEBHOOK',
  383. to: string
  384. cc: string[]
  385. hookUrl: string
  386. hookMethod: 'POST' | 'GET'
  387. customHeaders: Record<string, string>
  388. }
  389. }
  390. }
  391. }
  392. }