@synnaxlabs/client 0.56.2 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (741) hide show
  1. package/dist/client-B08VDLSA.js +14463 -0
  2. package/dist/client-B08VDLSA.js.map +1 -0
  3. package/dist/client.js +1128 -14876
  4. package/dist/client.js.map +1 -0
  5. package/dist/src/access/client.d.ts +10 -1
  6. package/dist/src/access/client.d.ts.map +1 -1
  7. package/dist/src/access/enforce.d.ts.map +1 -1
  8. package/dist/src/access/external.d.ts +1 -0
  9. package/dist/src/access/external.d.ts.map +1 -1
  10. package/dist/src/access/granted.d.ts +39 -0
  11. package/dist/src/access/granted.d.ts.map +1 -0
  12. package/dist/src/access/policy/client.d.ts +136 -147
  13. package/dist/src/access/policy/client.d.ts.map +1 -1
  14. package/dist/src/access/policy/types.gen.d.ts +15 -68
  15. package/dist/src/access/policy/types.gen.d.ts.map +1 -1
  16. package/dist/src/access/role/client.d.ts +77 -58
  17. package/dist/src/access/role/client.d.ts.map +1 -1
  18. package/dist/src/access/role/types.gen.d.ts +8 -14
  19. package/dist/src/access/role/types.gen.d.ts.map +1 -1
  20. package/dist/src/actions/actions.d.ts +5 -6
  21. package/dist/src/actions/actions.d.ts.map +1 -1
  22. package/dist/src/actions/controller.d.ts +194 -0
  23. package/dist/src/actions/controller.d.ts.map +1 -0
  24. package/dist/src/actions/external.d.ts +1 -0
  25. package/dist/src/actions/external.d.ts.map +1 -1
  26. package/dist/src/arc/actions.d.ts +575 -0
  27. package/dist/src/arc/actions.d.ts.map +1 -0
  28. package/dist/src/arc/actions.gen.d.ts +1439 -0
  29. package/dist/src/arc/actions.gen.d.ts.map +1 -0
  30. package/dist/src/arc/client.d.ts +97 -13
  31. package/dist/src/arc/client.d.ts.map +1 -1
  32. package/dist/src/arc/compiler/types.gen.d.ts +3 -3
  33. package/dist/src/arc/compiler/types.gen.d.ts.map +1 -1
  34. package/dist/src/arc/external.d.ts +2 -0
  35. package/dist/src/arc/external.d.ts.map +1 -1
  36. package/dist/src/arc/graph/types.gen.d.ts +45 -597
  37. package/dist/src/arc/graph/types.gen.d.ts.map +1 -1
  38. package/dist/src/arc/ir/index.d.ts +1 -1
  39. package/dist/src/arc/ir/index.d.ts.map +1 -1
  40. package/dist/src/arc/ir/ir.d.ts +2 -0
  41. package/dist/src/arc/ir/ir.d.ts.map +1 -0
  42. package/dist/src/arc/ir/types.gen.d.ts +58 -2807
  43. package/dist/src/arc/ir/types.gen.d.ts.map +1 -1
  44. package/dist/src/arc/module/types.gen.d.ts +18 -1090
  45. package/dist/src/arc/module/types.gen.d.ts.map +1 -1
  46. package/dist/src/arc/program/types.gen.d.ts +18 -1090
  47. package/dist/src/arc/program/types.gen.d.ts.map +1 -1
  48. package/dist/src/arc/text/types.gen.d.ts +54 -1
  49. package/dist/src/arc/text/types.gen.d.ts.map +1 -1
  50. package/dist/src/arc/types/types.gen.d.ts +35 -153
  51. package/dist/src/arc/types/types.gen.d.ts.map +1 -1
  52. package/dist/src/arc/types.gen.d.ts +98 -2278
  53. package/dist/src/arc/types.gen.d.ts.map +1 -1
  54. package/dist/src/auth/auth.d.ts +14 -2
  55. package/dist/src/auth/auth.d.ts.map +1 -1
  56. package/dist/src/channel/client.d.ts +113 -75
  57. package/dist/src/channel/client.d.ts.map +1 -1
  58. package/dist/src/channel/external.d.ts +0 -1
  59. package/dist/src/channel/external.d.ts.map +1 -1
  60. package/dist/src/channel/payload.d.ts +65 -56
  61. package/dist/src/channel/payload.d.ts.map +1 -1
  62. package/dist/src/channel/types.gen.d.ts +26 -73
  63. package/dist/src/channel/types.gen.d.ts.map +1 -1
  64. package/dist/src/channel/writer.d.ts +1 -3
  65. package/dist/src/channel/writer.d.ts.map +1 -1
  66. package/dist/src/client.d.ts +55 -27
  67. package/dist/src/client.d.ts.map +1 -1
  68. package/dist/src/connection/client.d.ts +146 -0
  69. package/dist/src/connection/client.d.ts.map +1 -0
  70. package/dist/src/connection/external.d.ts +3 -0
  71. package/dist/src/connection/external.d.ts.map +1 -0
  72. package/dist/src/connection/index.d.ts +1 -1
  73. package/dist/src/connection/index.d.ts.map +1 -1
  74. package/dist/src/connection/status.d.ts +252 -0
  75. package/dist/src/connection/status.d.ts.map +1 -0
  76. package/dist/src/control/client.d.ts +31 -7
  77. package/dist/src/control/client.d.ts.map +1 -1
  78. package/dist/src/control/state.d.ts +47 -16
  79. package/dist/src/control/state.d.ts.map +1 -1
  80. package/dist/src/device/client.d.ts +59 -17
  81. package/dist/src/device/client.d.ts.map +1 -1
  82. package/dist/src/device/types.gen.d.ts +17 -67
  83. package/dist/src/device/types.gen.d.ts.map +1 -1
  84. package/dist/src/errors.d.ts +17 -20
  85. package/dist/src/errors.d.ts.map +1 -1
  86. package/dist/src/ethercat/external.d.ts +2 -0
  87. package/dist/src/ethercat/external.d.ts.map +1 -0
  88. package/dist/src/ethercat/index.d.ts +2 -0
  89. package/dist/src/ethercat/index.d.ts.map +1 -0
  90. package/dist/src/ethercat/types.gen.d.ts +243 -0
  91. package/dist/src/ethercat/types.gen.d.ts.map +1 -0
  92. package/dist/src/framer/adapter.d.ts +8 -5
  93. package/dist/src/framer/adapter.d.ts.map +1 -1
  94. package/dist/src/framer/benchutil.d.ts +19 -0
  95. package/dist/src/framer/benchutil.d.ts.map +1 -0
  96. package/dist/src/framer/cache/cache.d.ts +38 -0
  97. package/dist/src/framer/cache/cache.d.ts.map +1 -0
  98. package/dist/src/framer/cache/dynamic.d.ts +71 -0
  99. package/dist/src/framer/cache/dynamic.d.ts.map +1 -0
  100. package/dist/src/framer/cache/reader.d.ts +43 -0
  101. package/dist/src/framer/cache/reader.d.ts.map +1 -0
  102. package/dist/src/framer/cache/static.d.ts +66 -0
  103. package/dist/src/framer/cache/static.d.ts.map +1 -0
  104. package/dist/src/framer/cache/streamer.d.ts +86 -0
  105. package/dist/src/framer/cache/streamer.d.ts.map +1 -0
  106. package/dist/src/framer/cache/transform.d.ts +18 -0
  107. package/dist/src/framer/cache/transform.d.ts.map +1 -0
  108. package/dist/src/framer/cache/unary.d.ts +37 -0
  109. package/dist/src/framer/cache/unary.d.ts.map +1 -0
  110. package/dist/src/framer/client.d.ts +35 -14
  111. package/dist/src/framer/client.d.ts.map +1 -1
  112. package/dist/src/framer/codec.d.ts.map +1 -1
  113. package/dist/src/framer/deleter.d.ts +3 -2
  114. package/dist/src/framer/deleter.d.ts.map +1 -1
  115. package/dist/src/framer/external.d.ts +6 -0
  116. package/dist/src/framer/external.d.ts.map +1 -1
  117. package/dist/src/framer/feed.d.ts +40 -0
  118. package/dist/src/framer/feed.d.ts.map +1 -0
  119. package/dist/src/framer/frame.d.ts +16 -20
  120. package/dist/src/framer/frame.d.ts.map +1 -1
  121. package/dist/src/framer/hardened.d.ts +70 -0
  122. package/dist/src/framer/hardened.d.ts.map +1 -0
  123. package/dist/src/framer/iterator.d.ts +36 -43
  124. package/dist/src/framer/iterator.d.ts.map +1 -1
  125. package/dist/src/framer/reader.d.ts +3 -2
  126. package/dist/src/framer/reader.d.ts.map +1 -1
  127. package/dist/src/framer/streamer.d.ts +132 -205
  128. package/dist/src/framer/streamer.d.ts.map +1 -1
  129. package/dist/src/framer/writer.d.ts +130 -161
  130. package/dist/src/framer/writer.d.ts.map +1 -1
  131. package/dist/src/group/client.d.ts +66 -9
  132. package/dist/src/group/client.d.ts.map +1 -1
  133. package/dist/src/group/types.gen.d.ts +2 -2
  134. package/dist/src/http/external.d.ts +2 -0
  135. package/dist/src/http/external.d.ts.map +1 -0
  136. package/dist/src/http/index.d.ts +2 -0
  137. package/dist/src/http/index.d.ts.map +1 -0
  138. package/dist/src/http/types.gen.d.ts +451 -0
  139. package/dist/src/http/types.gen.d.ts.map +1 -0
  140. package/dist/src/imex/client.d.ts +88 -0
  141. package/dist/src/imex/client.d.ts.map +1 -0
  142. package/dist/src/imex/index.d.ts +2 -0
  143. package/dist/src/imex/index.d.ts.map +1 -0
  144. package/dist/src/index.d.ts +18 -5
  145. package/dist/src/index.d.ts.map +1 -1
  146. package/dist/src/label/client.d.ts +55 -36
  147. package/dist/src/label/client.d.ts.map +1 -1
  148. package/dist/src/label/external.d.ts +2 -0
  149. package/dist/src/label/external.d.ts.map +1 -1
  150. package/dist/src/label/payload.d.ts +4 -46
  151. package/dist/src/label/payload.d.ts.map +1 -1
  152. package/dist/src/label/store.d.ts +8 -0
  153. package/dist/src/label/store.d.ts.map +1 -0
  154. package/dist/src/label/types.gen.d.ts +45 -0
  155. package/dist/src/label/types.gen.d.ts.map +1 -0
  156. package/dist/src/labjack/external.d.ts +2 -0
  157. package/dist/src/labjack/external.d.ts.map +1 -0
  158. package/dist/src/labjack/index.d.ts +2 -0
  159. package/dist/src/labjack/index.d.ts.map +1 -0
  160. package/dist/src/labjack/types.gen.d.ts +442 -0
  161. package/dist/src/labjack/types.gen.d.ts.map +1 -0
  162. package/dist/src/lineplot/actions.d.ts +914 -0
  163. package/dist/src/lineplot/actions.d.ts.map +1 -0
  164. package/dist/src/lineplot/actions.gen.d.ts +4208 -0
  165. package/dist/src/lineplot/actions.gen.d.ts.map +1 -0
  166. package/dist/src/lineplot/client.d.ts +66 -16
  167. package/dist/src/lineplot/client.d.ts.map +1 -1
  168. package/dist/src/lineplot/external.d.ts +3 -0
  169. package/dist/src/lineplot/external.d.ts.map +1 -1
  170. package/dist/src/lineplot/line.d.ts +16 -0
  171. package/dist/src/lineplot/line.d.ts.map +1 -0
  172. package/dist/src/lineplot/types.gen.d.ts +837 -14
  173. package/dist/src/lineplot/types.gen.d.ts.map +1 -1
  174. package/dist/src/log/actions.d.ts +271 -0
  175. package/dist/src/log/actions.d.ts.map +1 -0
  176. package/dist/src/log/actions.gen.d.ts +1529 -0
  177. package/dist/src/log/actions.gen.d.ts.map +1 -0
  178. package/dist/src/log/client.d.ts +66 -16
  179. package/dist/src/log/client.d.ts.map +1 -1
  180. package/dist/src/log/external.d.ts +2 -0
  181. package/dist/src/log/external.d.ts.map +1 -1
  182. package/dist/src/log/types.gen.d.ts +139 -14
  183. package/dist/src/log/types.gen.d.ts.map +1 -1
  184. package/dist/src/modbus/external.d.ts +2 -0
  185. package/dist/src/modbus/external.d.ts.map +1 -0
  186. package/dist/src/modbus/index.d.ts +2 -0
  187. package/dist/src/modbus/index.d.ts.map +1 -0
  188. package/dist/src/modbus/types.gen.d.ts +280 -0
  189. package/dist/src/modbus/types.gen.d.ts.map +1 -0
  190. package/dist/src/ni/external.d.ts +2 -0
  191. package/dist/src/ni/external.d.ts.map +1 -0
  192. package/dist/src/ni/index.d.ts +2 -0
  193. package/dist/src/ni/index.d.ts.map +1 -0
  194. package/dist/src/ni/types.gen.d.ts +21029 -0
  195. package/dist/src/ni/types.gen.d.ts.map +1 -0
  196. package/dist/src/node/index.d.ts +2 -0
  197. package/dist/src/node/index.d.ts.map +1 -0
  198. package/dist/src/node/types.gen.d.ts +4 -0
  199. package/dist/src/node/types.gen.d.ts.map +1 -0
  200. package/dist/src/ontology/client.d.ts +314 -67
  201. package/dist/src/ontology/client.d.ts.map +1 -1
  202. package/dist/src/ontology/external.d.ts +1 -0
  203. package/dist/src/ontology/external.d.ts.map +1 -1
  204. package/dist/src/ontology/payload.d.ts +60 -18
  205. package/dist/src/ontology/payload.d.ts.map +1 -1
  206. package/dist/src/ontology/store.d.ts +32 -0
  207. package/dist/src/ontology/store.d.ts.map +1 -0
  208. package/dist/src/ontology/types.gen.d.ts +3 -2
  209. package/dist/src/ontology/types.gen.d.ts.map +1 -1
  210. package/dist/src/ontology/writer.d.ts +16 -10
  211. package/dist/src/ontology/writer.d.ts.map +1 -1
  212. package/dist/src/opcua/external.d.ts +2 -0
  213. package/dist/src/opcua/external.d.ts.map +1 -0
  214. package/dist/src/opcua/index.d.ts +2 -0
  215. package/dist/src/opcua/index.d.ts.map +1 -0
  216. package/dist/src/opcua/types.gen.d.ts +82 -0
  217. package/dist/src/opcua/types.gen.d.ts.map +1 -0
  218. package/dist/src/pagerduty/external.d.ts +2 -0
  219. package/dist/src/pagerduty/external.d.ts.map +1 -0
  220. package/dist/src/pagerduty/index.d.ts +2 -0
  221. package/dist/src/pagerduty/index.d.ts.map +1 -0
  222. package/dist/src/pagerduty/types.gen.d.ts +30 -0
  223. package/dist/src/pagerduty/types.gen.d.ts.map +1 -0
  224. package/dist/src/panel/actions.d.ts +273 -0
  225. package/dist/src/panel/actions.d.ts.map +1 -0
  226. package/dist/src/panel/actions.gen.d.ts +1255 -0
  227. package/dist/src/panel/actions.gen.d.ts.map +1 -0
  228. package/dist/src/panel/client.d.ts +148 -0
  229. package/dist/src/panel/client.d.ts.map +1 -0
  230. package/dist/src/panel/external.d.ts +6 -0
  231. package/dist/src/panel/external.d.ts.map +1 -0
  232. package/dist/src/panel/index.d.ts +2 -0
  233. package/dist/src/panel/index.d.ts.map +1 -0
  234. package/dist/src/panel/tree.d.ts +50 -0
  235. package/dist/src/panel/tree.d.ts.map +1 -0
  236. package/dist/src/panel/types.gen.d.ts +370 -0
  237. package/dist/src/panel/types.gen.d.ts.map +1 -0
  238. package/dist/src/project/client.d.ts +89 -0
  239. package/dist/src/project/client.d.ts.map +1 -0
  240. package/dist/src/project/external.d.ts.map +1 -0
  241. package/dist/src/project/index.d.ts +2 -0
  242. package/dist/src/project/index.d.ts.map +1 -0
  243. package/dist/src/project/types.gen.d.ts +27 -0
  244. package/dist/src/project/types.gen.d.ts.map +1 -0
  245. package/dist/src/query/cache.d.ts +132 -0
  246. package/dist/src/query/cache.d.ts.map +1 -0
  247. package/dist/src/query/deleted.d.ts +20 -0
  248. package/dist/src/query/deleted.d.ts.map +1 -0
  249. package/dist/src/query/derived.d.ts +33 -0
  250. package/dist/src/query/derived.d.ts.map +1 -0
  251. package/dist/src/query/external.d.ts +10 -0
  252. package/dist/src/query/external.d.ts.map +1 -0
  253. package/dist/src/query/index.d.ts +2 -0
  254. package/dist/src/query/index.d.ts.map +1 -0
  255. package/dist/src/query/query.d.ts +235 -0
  256. package/dist/src/query/query.d.ts.map +1 -0
  257. package/dist/src/query/retriever.d.ts +135 -0
  258. package/dist/src/query/retriever.d.ts.map +1 -0
  259. package/dist/src/query/streamer.d.ts +67 -0
  260. package/dist/src/query/streamer.d.ts.map +1 -0
  261. package/dist/src/query/table.d.ts +219 -0
  262. package/dist/src/query/table.d.ts.map +1 -0
  263. package/dist/src/query/types.d.ts +35 -0
  264. package/dist/src/query/types.d.ts.map +1 -0
  265. package/dist/src/query/write.d.ts +21 -0
  266. package/dist/src/query/write.d.ts.map +1 -0
  267. package/dist/src/rack/client.d.ts +58 -20
  268. package/dist/src/rack/client.d.ts.map +1 -1
  269. package/dist/src/rack/types.gen.d.ts +11 -12
  270. package/dist/src/rack/types.gen.d.ts.map +1 -1
  271. package/dist/src/range/alias/types.gen.d.ts +2 -3
  272. package/dist/src/range/alias/types.gen.d.ts.map +1 -1
  273. package/dist/src/ranger/client.d.ts +138 -27
  274. package/dist/src/ranger/client.d.ts.map +1 -1
  275. package/dist/src/ranger/kv/client.d.ts +7 -4
  276. package/dist/src/ranger/kv/client.d.ts.map +1 -1
  277. package/dist/src/ranger/payload.d.ts +3 -0
  278. package/dist/src/ranger/payload.d.ts.map +1 -1
  279. package/dist/src/ranger/types.gen.d.ts +45 -101
  280. package/dist/src/ranger/types.gen.d.ts.map +1 -1
  281. package/dist/src/ranger/writer.d.ts +2 -74
  282. package/dist/src/ranger/writer.d.ts.map +1 -1
  283. package/dist/src/schematic/actions.d.ts +90 -33
  284. package/dist/src/schematic/actions.d.ts.map +1 -1
  285. package/dist/src/schematic/actions.gen.d.ts +207 -114
  286. package/dist/src/schematic/actions.gen.d.ts.map +1 -1
  287. package/dist/src/schematic/client.d.ts +70 -68
  288. package/dist/src/schematic/client.d.ts.map +1 -1
  289. package/dist/src/schematic/symbol/client.d.ts +133 -27
  290. package/dist/src/schematic/symbol/client.d.ts.map +1 -1
  291. package/dist/src/schematic/symbol/types.gen.d.ts +258 -153
  292. package/dist/src/schematic/symbol/types.gen.d.ts.map +1 -1
  293. package/dist/src/schematic/types.gen.d.ts +17 -96
  294. package/dist/src/schematic/types.gen.d.ts.map +1 -1
  295. package/dist/src/status/client.d.ts +69 -14
  296. package/dist/src/status/client.d.ts.map +1 -1
  297. package/dist/src/status/external.d.ts +2 -0
  298. package/dist/src/status/external.d.ts.map +1 -1
  299. package/dist/src/status/payload.d.ts +2 -36
  300. package/dist/src/status/payload.d.ts.map +1 -1
  301. package/dist/src/status/status.d.ts +65 -0
  302. package/dist/src/status/status.d.ts.map +1 -0
  303. package/dist/src/status/types.gen.d.ts +58 -0
  304. package/dist/src/status/types.gen.d.ts.map +1 -0
  305. package/dist/src/table/actions.d.ts +72 -13
  306. package/dist/src/table/actions.d.ts.map +1 -1
  307. package/dist/src/table/actions.gen.d.ts +221 -137
  308. package/dist/src/table/actions.gen.d.ts.map +1 -1
  309. package/dist/src/table/client.d.ts +64 -40
  310. package/dist/src/table/client.d.ts.map +1 -1
  311. package/dist/src/table/types.gen.d.ts +20 -55
  312. package/dist/src/table/types.gen.d.ts.map +1 -1
  313. package/dist/src/task/client.d.ts +149 -28
  314. package/dist/src/task/client.d.ts.map +1 -1
  315. package/dist/src/task/types.gen.d.ts +71 -89
  316. package/dist/src/task/types.gen.d.ts.map +1 -1
  317. package/dist/src/testutil/access.d.ts +27 -1
  318. package/dist/src/testutil/access.d.ts.map +1 -1
  319. package/dist/src/testutil/channels.d.ts +2 -0
  320. package/dist/src/testutil/channels.d.ts.map +1 -1
  321. package/dist/src/testutil/client.d.ts +5 -0
  322. package/dist/src/testutil/client.d.ts.map +1 -1
  323. package/dist/src/testutil/connection.d.ts +10 -0
  324. package/dist/src/testutil/connection.d.ts.map +1 -0
  325. package/dist/src/testutil/index.d.ts +9 -0
  326. package/dist/src/testutil/index.d.ts.map +1 -0
  327. package/dist/src/testutil/panels.d.ts +8 -0
  328. package/dist/src/testutil/panels.d.ts.map +1 -0
  329. package/dist/src/testutil/proxy.d.ts +29 -0
  330. package/dist/src/testutil/proxy.d.ts.map +1 -0
  331. package/dist/src/testutil/query.d.ts +7 -0
  332. package/dist/src/testutil/query.d.ts.map +1 -0
  333. package/dist/src/testutil/telem.d.ts +4 -0
  334. package/dist/src/testutil/telem.d.ts.map +1 -1
  335. package/dist/src/transport.d.ts +10 -4
  336. package/dist/src/transport.d.ts.map +1 -1
  337. package/dist/src/user/client.d.ts +29 -28
  338. package/dist/src/user/client.d.ts.map +1 -1
  339. package/dist/src/user/external.d.ts +1 -1
  340. package/dist/src/user/external.d.ts.map +1 -1
  341. package/dist/src/user/types.gen.d.ts +4 -4
  342. package/dist/src/util/retrieve.d.ts +2 -2
  343. package/dist/src/util/retrieve.d.ts.map +1 -1
  344. package/dist/src/util/telem.d.ts.map +1 -1
  345. package/dist/src/view/client.d.ts +30 -14
  346. package/dist/src/view/client.d.ts.map +1 -1
  347. package/dist/src/view/types.gen.d.ts +7 -15
  348. package/dist/src/view/types.gen.d.ts.map +1 -1
  349. package/dist/testutil.js +189 -0
  350. package/dist/testutil.js.map +1 -0
  351. package/package.json +40 -17
  352. package/src/access/client.ts +14 -3
  353. package/src/access/enforce.ts +0 -3
  354. package/src/access/external.ts +1 -0
  355. package/src/access/granted.ts +114 -0
  356. package/src/access/policy/client.ts +135 -43
  357. package/src/access/policy/types.gen.ts +9 -11
  358. package/src/access/role/client.ts +160 -38
  359. package/src/access/role/types.gen.ts +8 -12
  360. package/src/actions/actions.ts +5 -6
  361. package/src/actions/controller.ts +626 -0
  362. package/src/actions/external.ts +11 -0
  363. package/src/arc/actions.gen.ts +313 -0
  364. package/src/arc/actions.ts +192 -0
  365. package/src/arc/client.ts +424 -41
  366. package/src/arc/compiler/types.gen.ts +5 -6
  367. package/src/arc/external.ts +2 -0
  368. package/src/arc/graph/types.gen.ts +24 -22
  369. package/src/arc/ir/index.ts +1 -1
  370. package/{eslint.config.ts → src/arc/ir/ir.ts} +1 -4
  371. package/src/arc/ir/types.gen.ts +42 -41
  372. package/src/arc/text/types.gen.ts +21 -2
  373. package/src/arc/types/types.gen.ts +40 -32
  374. package/src/arc/types.gen.ts +31 -29
  375. package/src/auth/auth.ts +40 -8
  376. package/src/channel/client.ts +529 -132
  377. package/src/channel/external.ts +0 -1
  378. package/src/channel/payload.ts +30 -3
  379. package/src/channel/types.gen.ts +37 -48
  380. package/src/channel/writer.ts +2 -11
  381. package/src/client.ts +215 -91
  382. package/src/connection/client.ts +495 -0
  383. package/src/connection/external.ts +34 -0
  384. package/src/connection/index.ts +1 -1
  385. package/src/connection/status.ts +442 -0
  386. package/src/control/client.ts +84 -12
  387. package/src/control/state.ts +17 -36
  388. package/src/device/client.ts +293 -41
  389. package/src/device/types.gen.ts +15 -26
  390. package/src/errors.ts +45 -22
  391. package/src/{workspace → ethercat}/external.ts +1 -2
  392. package/src/{workspace → ethercat}/index.ts +1 -1
  393. package/src/ethercat/types.gen.ts +151 -0
  394. package/src/framer/adapter.ts +60 -37
  395. package/src/framer/benchutil.ts +67 -0
  396. package/src/framer/cache/cache.ts +115 -0
  397. package/src/framer/cache/dynamic.ts +279 -0
  398. package/src/framer/cache/reader.ts +160 -0
  399. package/src/framer/cache/static.ts +215 -0
  400. package/src/framer/cache/streamer.ts +391 -0
  401. package/src/framer/cache/transform.ts +31 -0
  402. package/src/framer/cache/unary.ts +104 -0
  403. package/src/framer/client.ts +71 -43
  404. package/src/framer/codec.ts +55 -18
  405. package/src/framer/deleter.ts +4 -6
  406. package/src/framer/external.ts +10 -0
  407. package/src/framer/feed.ts +108 -0
  408. package/src/framer/frame.ts +13 -23
  409. package/src/framer/hardened.ts +283 -0
  410. package/src/framer/iterator.ts +31 -42
  411. package/src/framer/reader.ts +11 -11
  412. package/src/framer/streamer.ts +18 -178
  413. package/src/framer/writer.ts +39 -59
  414. package/src/group/client.ts +158 -23
  415. package/src/http/external.ts +10 -0
  416. package/src/{cluster → http}/index.ts +1 -1
  417. package/src/http/types.gen.ts +245 -0
  418. package/src/imex/client.ts +125 -0
  419. package/src/imex/index.ts +10 -0
  420. package/src/index.ts +18 -6
  421. package/src/label/client.ts +193 -54
  422. package/src/label/external.ts +2 -0
  423. package/src/label/payload.ts +4 -9
  424. package/src/label/store.ts +28 -0
  425. package/src/label/types.gen.ts +31 -0
  426. package/src/labjack/external.ts +10 -0
  427. package/src/labjack/index.ts +10 -0
  428. package/src/labjack/types.gen.ts +251 -0
  429. package/src/lineplot/actions.gen.ts +880 -0
  430. package/src/lineplot/actions.ts +535 -0
  431. package/src/lineplot/client.ts +224 -52
  432. package/src/lineplot/external.ts +3 -0
  433. package/src/lineplot/line.ts +80 -0
  434. package/src/lineplot/types.gen.ts +225 -12
  435. package/src/log/actions.gen.ts +474 -0
  436. package/src/log/actions.ts +242 -0
  437. package/src/log/client.ts +223 -52
  438. package/src/log/external.ts +2 -0
  439. package/src/log/types.gen.ts +45 -14
  440. package/src/modbus/external.ts +10 -0
  441. package/src/modbus/index.ts +10 -0
  442. package/src/modbus/types.gen.ts +185 -0
  443. package/src/ni/external.ts +10 -0
  444. package/src/ni/index.ts +10 -0
  445. package/src/ni/types.gen.ts +1632 -0
  446. package/src/node/index.ts +10 -0
  447. package/src/{cluster → node}/types.gen.ts +2 -2
  448. package/src/ontology/client.ts +408 -99
  449. package/src/ontology/external.ts +7 -0
  450. package/src/ontology/payload.ts +48 -7
  451. package/src/ontology/store.ts +83 -0
  452. package/src/ontology/types.gen.ts +2 -1
  453. package/src/ontology/writer.ts +1 -0
  454. package/src/opcua/external.ts +10 -0
  455. package/src/opcua/index.ts +10 -0
  456. package/src/opcua/types.gen.ts +65 -0
  457. package/src/pagerduty/external.ts +10 -0
  458. package/src/pagerduty/index.ts +10 -0
  459. package/src/pagerduty/types.gen.ts +41 -0
  460. package/src/panel/actions.gen.ts +267 -0
  461. package/src/panel/actions.ts +357 -0
  462. package/src/panel/client.ts +327 -0
  463. package/src/panel/external.ts +14 -0
  464. package/src/panel/index.ts +10 -0
  465. package/src/panel/tree.ts +163 -0
  466. package/src/panel/types.gen.ts +164 -0
  467. package/src/project/client.ts +273 -0
  468. package/src/project/external.ts +11 -0
  469. package/src/project/index.ts +10 -0
  470. package/src/project/types.gen.ts +40 -0
  471. package/src/query/cache.ts +326 -0
  472. package/src/query/deleted.ts +38 -0
  473. package/src/query/derived.ts +101 -0
  474. package/src/query/external.ts +51 -0
  475. package/src/query/index.ts +10 -0
  476. package/src/query/query.ts +865 -0
  477. package/src/query/retriever.ts +308 -0
  478. package/src/query/streamer.ts +207 -0
  479. package/src/query/table.ts +625 -0
  480. package/src/query/types.ts +54 -0
  481. package/src/query/write.ts +42 -0
  482. package/src/rack/client.ts +233 -45
  483. package/src/rack/types.gen.ts +15 -16
  484. package/src/range/alias/types.gen.ts +2 -3
  485. package/src/ranger/client.ts +581 -70
  486. package/src/ranger/kv/client.ts +52 -21
  487. package/src/ranger/payload.ts +3 -0
  488. package/src/ranger/types.gen.ts +21 -23
  489. package/src/ranger/writer.ts +4 -8
  490. package/src/schematic/actions.gen.ts +62 -53
  491. package/src/schematic/actions.ts +44 -42
  492. package/src/schematic/client.ts +226 -70
  493. package/src/schematic/symbol/client.ts +277 -48
  494. package/src/schematic/symbol/types.gen.ts +22 -34
  495. package/src/schematic/types.gen.ts +22 -29
  496. package/src/status/client.ts +321 -44
  497. package/src/status/external.ts +2 -0
  498. package/src/status/payload.ts +1 -23
  499. package/src/status/status.ts +241 -0
  500. package/src/status/types.gen.ts +108 -0
  501. package/src/table/actions.gen.ts +96 -63
  502. package/src/table/actions.ts +44 -19
  503. package/src/table/client.ts +220 -56
  504. package/src/table/types.gen.ts +24 -31
  505. package/src/task/client.ts +580 -101
  506. package/src/task/types.gen.ts +68 -75
  507. package/src/testutil/access.ts +102 -6
  508. package/src/testutil/channels.ts +29 -0
  509. package/src/testutil/client.ts +27 -2
  510. package/src/testutil/connection.ts +47 -0
  511. package/src/testutil/index.ts +17 -0
  512. package/src/testutil/panels.ts +26 -0
  513. package/src/testutil/proxy.ts +106 -0
  514. package/src/testutil/query.ts +28 -0
  515. package/src/testutil/telem.ts +17 -1
  516. package/src/transport.ts +18 -7
  517. package/src/user/client.ts +165 -64
  518. package/src/user/external.ts +1 -1
  519. package/src/user/types.gen.ts +5 -5
  520. package/src/util/retrieve.ts +4 -4
  521. package/src/util/telem.ts +0 -1
  522. package/src/view/client.ts +120 -37
  523. package/src/view/types.gen.ts +8 -11
  524. package/.turbo/turbo-build.log +0 -20
  525. package/.vscode/settings.json +0 -3
  526. package/CONTRIBUTING.md +0 -47
  527. package/dist/client.cjs +0 -118
  528. package/dist/eslint.config.d.ts +0 -4
  529. package/dist/eslint.config.d.ts.map +0 -1
  530. package/dist/src/access/enforce.spec.d.ts +0 -2
  531. package/dist/src/access/enforce.spec.d.ts.map +0 -1
  532. package/dist/src/access/policy/access.spec.d.ts +0 -2
  533. package/dist/src/access/policy/access.spec.d.ts.map +0 -1
  534. package/dist/src/access/role/role.spec.d.ts +0 -2
  535. package/dist/src/access/role/role.spec.d.ts.map +0 -1
  536. package/dist/src/actions/actions.spec.d.ts +0 -2
  537. package/dist/src/actions/actions.spec.d.ts.map +0 -1
  538. package/dist/src/arc/access.spec.d.ts +0 -2
  539. package/dist/src/arc/access.spec.d.ts.map +0 -1
  540. package/dist/src/arc/arc.spec.d.ts +0 -2
  541. package/dist/src/arc/arc.spec.d.ts.map +0 -1
  542. package/dist/src/arc/lsp.spec.d.ts +0 -2
  543. package/dist/src/arc/lsp.spec.d.ts.map +0 -1
  544. package/dist/src/auth/auth.spec.d.ts +0 -2
  545. package/dist/src/auth/auth.spec.d.ts.map +0 -1
  546. package/dist/src/channel/access.spec.d.ts +0 -2
  547. package/dist/src/channel/access.spec.d.ts.map +0 -1
  548. package/dist/src/channel/batchRetriever.spec.d.ts +0 -2
  549. package/dist/src/channel/batchRetriever.spec.d.ts.map +0 -1
  550. package/dist/src/channel/channel.spec.d.ts +0 -2
  551. package/dist/src/channel/channel.spec.d.ts.map +0 -1
  552. package/dist/src/channel/payload.spec.d.ts +0 -2
  553. package/dist/src/channel/payload.spec.d.ts.map +0 -1
  554. package/dist/src/channel/retriever.d.ts +0 -64
  555. package/dist/src/channel/retriever.d.ts.map +0 -1
  556. package/dist/src/cluster/index.d.ts +0 -2
  557. package/dist/src/cluster/index.d.ts.map +0 -1
  558. package/dist/src/cluster/types.gen.d.ts +0 -4
  559. package/dist/src/cluster/types.gen.d.ts.map +0 -1
  560. package/dist/src/connection/checker.d.ts +0 -86
  561. package/dist/src/connection/checker.d.ts.map +0 -1
  562. package/dist/src/connection/connection.spec.d.ts +0 -2
  563. package/dist/src/connection/connection.spec.d.ts.map +0 -1
  564. package/dist/src/connection.spec.d.ts +0 -2
  565. package/dist/src/connection.spec.d.ts.map +0 -1
  566. package/dist/src/control/state.spec.d.ts +0 -2
  567. package/dist/src/control/state.spec.d.ts.map +0 -1
  568. package/dist/src/device/access.spec.d.ts +0 -2
  569. package/dist/src/device/access.spec.d.ts.map +0 -1
  570. package/dist/src/device/device.spec.d.ts +0 -2
  571. package/dist/src/device/device.spec.d.ts.map +0 -1
  572. package/dist/src/device/payload.spec.d.ts +0 -2
  573. package/dist/src/device/payload.spec.d.ts.map +0 -1
  574. package/dist/src/errors.spec.d.ts +0 -2
  575. package/dist/src/errors.spec.d.ts.map +0 -1
  576. package/dist/src/framer/adapter.spec.d.ts +0 -2
  577. package/dist/src/framer/adapter.spec.d.ts.map +0 -1
  578. package/dist/src/framer/client.spec.d.ts +0 -2
  579. package/dist/src/framer/client.spec.d.ts.map +0 -1
  580. package/dist/src/framer/codec.spec.d.ts +0 -2
  581. package/dist/src/framer/codec.spec.d.ts.map +0 -1
  582. package/dist/src/framer/deleter.spec.d.ts +0 -2
  583. package/dist/src/framer/deleter.spec.d.ts.map +0 -1
  584. package/dist/src/framer/frame.spec.d.ts +0 -2
  585. package/dist/src/framer/frame.spec.d.ts.map +0 -1
  586. package/dist/src/framer/iterator.spec.d.ts +0 -2
  587. package/dist/src/framer/iterator.spec.d.ts.map +0 -1
  588. package/dist/src/framer/reader.spec.d.ts +0 -2
  589. package/dist/src/framer/reader.spec.d.ts.map +0 -1
  590. package/dist/src/framer/streamer.spec.d.ts +0 -2
  591. package/dist/src/framer/streamer.spec.d.ts.map +0 -1
  592. package/dist/src/framer/writer.spec.d.ts +0 -2
  593. package/dist/src/framer/writer.spec.d.ts.map +0 -1
  594. package/dist/src/group/access.spec.d.ts +0 -2
  595. package/dist/src/group/access.spec.d.ts.map +0 -1
  596. package/dist/src/group/group.spec.d.ts +0 -2
  597. package/dist/src/group/group.spec.d.ts.map +0 -1
  598. package/dist/src/label/access.spec.d.ts +0 -2
  599. package/dist/src/label/access.spec.d.ts.map +0 -1
  600. package/dist/src/label/label.spec.d.ts +0 -2
  601. package/dist/src/label/label.spec.d.ts.map +0 -1
  602. package/dist/src/lineplot/access.spec.d.ts +0 -2
  603. package/dist/src/lineplot/access.spec.d.ts.map +0 -1
  604. package/dist/src/lineplot/lineplot.spec.d.ts +0 -2
  605. package/dist/src/lineplot/lineplot.spec.d.ts.map +0 -1
  606. package/dist/src/log/access.spec.d.ts +0 -2
  607. package/dist/src/log/access.spec.d.ts.map +0 -1
  608. package/dist/src/log/log.spec.d.ts +0 -2
  609. package/dist/src/log/log.spec.d.ts.map +0 -1
  610. package/dist/src/ontology/ontology.spec.d.ts +0 -2
  611. package/dist/src/ontology/ontology.spec.d.ts.map +0 -1
  612. package/dist/src/rack/access.spec.d.ts +0 -2
  613. package/dist/src/rack/access.spec.d.ts.map +0 -1
  614. package/dist/src/rack/rack.spec.d.ts +0 -2
  615. package/dist/src/rack/rack.spec.d.ts.map +0 -1
  616. package/dist/src/ranger/access.spec.d.ts +0 -2
  617. package/dist/src/ranger/access.spec.d.ts.map +0 -1
  618. package/dist/src/ranger/alias/payload.spec.d.ts +0 -2
  619. package/dist/src/ranger/alias/payload.spec.d.ts.map +0 -1
  620. package/dist/src/ranger/ranger.spec.d.ts +0 -2
  621. package/dist/src/ranger/ranger.spec.d.ts.map +0 -1
  622. package/dist/src/schematic/access.spec.d.ts +0 -2
  623. package/dist/src/schematic/access.spec.d.ts.map +0 -1
  624. package/dist/src/schematic/actions.spec.d.ts +0 -2
  625. package/dist/src/schematic/actions.spec.d.ts.map +0 -1
  626. package/dist/src/schematic/schematic.spec.d.ts +0 -2
  627. package/dist/src/schematic/schematic.spec.d.ts.map +0 -1
  628. package/dist/src/schematic/symbol/access.spec.d.ts +0 -2
  629. package/dist/src/schematic/symbol/access.spec.d.ts.map +0 -1
  630. package/dist/src/schematic/symbol/client.spec.d.ts +0 -2
  631. package/dist/src/schematic/symbol/client.spec.d.ts.map +0 -1
  632. package/dist/src/status/access.spec.d.ts +0 -2
  633. package/dist/src/status/access.spec.d.ts.map +0 -1
  634. package/dist/src/status/status.spec.d.ts +0 -2
  635. package/dist/src/status/status.spec.d.ts.map +0 -1
  636. package/dist/src/table/access.spec.d.ts +0 -2
  637. package/dist/src/table/access.spec.d.ts.map +0 -1
  638. package/dist/src/table/table.spec.d.ts +0 -2
  639. package/dist/src/table/table.spec.d.ts.map +0 -1
  640. package/dist/src/task/access.spec.d.ts +0 -2
  641. package/dist/src/task/access.spec.d.ts.map +0 -1
  642. package/dist/src/task/payload.spec.d.ts +0 -2
  643. package/dist/src/task/payload.spec.d.ts.map +0 -1
  644. package/dist/src/task/task.spec.d.ts +0 -2
  645. package/dist/src/task/task.spec.d.ts.map +0 -1
  646. package/dist/src/user/access.spec.d.ts +0 -2
  647. package/dist/src/user/access.spec.d.ts.map +0 -1
  648. package/dist/src/user/user.spec.d.ts +0 -2
  649. package/dist/src/user/user.spec.d.ts.map +0 -1
  650. package/dist/src/util/retrieve.spec.d.ts +0 -2
  651. package/dist/src/util/retrieve.spec.d.ts.map +0 -1
  652. package/dist/src/view/view.spec.d.ts +0 -2
  653. package/dist/src/view/view.spec.d.ts.map +0 -1
  654. package/dist/src/workspace/access.spec.d.ts +0 -2
  655. package/dist/src/workspace/access.spec.d.ts.map +0 -1
  656. package/dist/src/workspace/client.d.ts +0 -36
  657. package/dist/src/workspace/client.d.ts.map +0 -1
  658. package/dist/src/workspace/external.d.ts.map +0 -1
  659. package/dist/src/workspace/index.d.ts +0 -2
  660. package/dist/src/workspace/index.d.ts.map +0 -1
  661. package/dist/src/workspace/types.gen.d.ts +0 -34
  662. package/dist/src/workspace/types.gen.d.ts.map +0 -1
  663. package/dist/src/workspace/workspace.spec.d.ts +0 -2
  664. package/dist/src/workspace/workspace.spec.d.ts.map +0 -1
  665. package/examples/node/basicReadWrite.js +0 -86
  666. package/examples/node/createChannels.js +0 -50
  667. package/examples/node/createRange.js +0 -67
  668. package/examples/node/package-lock.json +0 -133
  669. package/examples/node/package.json +0 -17
  670. package/examples/node/readLatest.js +0 -76
  671. package/examples/node/seriesAndFrames.js +0 -173
  672. package/examples/node/streamRead.js +0 -50
  673. package/examples/node/streamWrite.js +0 -87
  674. package/src/access/enforce.spec.ts +0 -188
  675. package/src/access/policy/access.spec.ts +0 -147
  676. package/src/access/role/role.spec.ts +0 -95
  677. package/src/actions/actions.spec.ts +0 -229
  678. package/src/arc/access.spec.ts +0 -149
  679. package/src/arc/arc.spec.ts +0 -44
  680. package/src/arc/lsp.spec.ts +0 -717
  681. package/src/auth/auth.spec.ts +0 -101
  682. package/src/channel/access.spec.ts +0 -116
  683. package/src/channel/batchRetriever.spec.ts +0 -115
  684. package/src/channel/channel.spec.ts +0 -352
  685. package/src/channel/payload.spec.ts +0 -117
  686. package/src/channel/retriever.ts +0 -252
  687. package/src/connection/checker.ts +0 -203
  688. package/src/connection/connection.spec.ts +0 -152
  689. package/src/connection.spec.ts +0 -145
  690. package/src/control/state.spec.ts +0 -22
  691. package/src/device/access.spec.ts +0 -159
  692. package/src/device/device.spec.ts +0 -461
  693. package/src/device/payload.spec.ts +0 -142
  694. package/src/errors.spec.ts +0 -71
  695. package/src/framer/adapter.spec.ts +0 -620
  696. package/src/framer/client.spec.ts +0 -180
  697. package/src/framer/codec.spec.ts +0 -383
  698. package/src/framer/deleter.spec.ts +0 -103
  699. package/src/framer/frame.spec.ts +0 -973
  700. package/src/framer/iterator.spec.ts +0 -169
  701. package/src/framer/reader.spec.ts +0 -865
  702. package/src/framer/streamer.spec.ts +0 -871
  703. package/src/framer/writer.spec.ts +0 -486
  704. package/src/group/access.spec.ts +0 -77
  705. package/src/group/group.spec.ts +0 -65
  706. package/src/label/access.spec.ts +0 -109
  707. package/src/label/label.spec.ts +0 -83
  708. package/src/lineplot/access.spec.ts +0 -134
  709. package/src/lineplot/lineplot.spec.ts +0 -120
  710. package/src/log/access.spec.ts +0 -132
  711. package/src/log/log.spec.ts +0 -106
  712. package/src/ontology/ontology.spec.ts +0 -521
  713. package/src/rack/access.spec.ts +0 -102
  714. package/src/rack/rack.spec.ts +0 -171
  715. package/src/ranger/access.spec.ts +0 -115
  716. package/src/ranger/alias/payload.spec.ts +0 -52
  717. package/src/ranger/ranger.spec.ts +0 -343
  718. package/src/schematic/access.spec.ts +0 -134
  719. package/src/schematic/actions.spec.ts +0 -699
  720. package/src/schematic/schematic.spec.ts +0 -340
  721. package/src/schematic/symbol/access.spec.ts +0 -172
  722. package/src/schematic/symbol/client.spec.ts +0 -160
  723. package/src/status/access.spec.ts +0 -129
  724. package/src/status/status.spec.ts +0 -448
  725. package/src/table/access.spec.ts +0 -128
  726. package/src/table/table.spec.ts +0 -651
  727. package/src/task/access.spec.ts +0 -131
  728. package/src/task/payload.spec.ts +0 -113
  729. package/src/task/task.spec.ts +0 -657
  730. package/src/user/access.spec.ts +0 -107
  731. package/src/user/user.spec.ts +0 -290
  732. package/src/util/retrieve.spec.ts +0 -49
  733. package/src/view/view.spec.ts +0 -165
  734. package/src/workspace/access.spec.ts +0 -108
  735. package/src/workspace/client.ts +0 -112
  736. package/src/workspace/types.gen.ts +0 -46
  737. package/src/workspace/workspace.spec.ts +0 -111
  738. package/tsconfig.json +0 -5
  739. package/tsconfig.vite.json +0 -4
  740. package/vite.config.ts +0 -29
  741. /package/dist/src/{workspace → project}/external.d.ts +0 -0
@@ -0,0 +1,1632 @@
1
+ // Copyright 2026 Synnax Labs, Inc.
2
+ //
3
+ // Use of this software is governed by the Business Source License included in the file
4
+ // licenses/BSL.txt.
5
+ //
6
+ // As of the Change Date specified in that file, in accordance with the Business Source
7
+ // License, use of this software will be governed by the Apache License, Version 2.0,
8
+ // included in the file licenses/APL.txt.
9
+
10
+ // Code generated by Oracle. DO NOT EDIT.
11
+
12
+ import { id } from "@synnaxlabs/x";
13
+ import { z } from "zod";
14
+
15
+ import { channel } from "@/channel";
16
+ import { device } from "@/device";
17
+ import { task } from "@/task";
18
+
19
+ export const TERMINAL_CONFIGS = [
20
+ "Cfg_Default",
21
+ "RSE",
22
+ "NRSE",
23
+ "Diff",
24
+ "PseudoDiff",
25
+ ] as const;
26
+ export const terminalConfigZ = z.enum(TERMINAL_CONFIGS);
27
+ export type TerminalConfig = z.infer<typeof terminalConfigZ>;
28
+
29
+ export const EXCITATION_SOURCES = ["Internal", "External", "None"] as const;
30
+ export const excitationSourceZ = z.enum(EXCITATION_SOURCES);
31
+ export type ExcitationSource = z.infer<typeof excitationSourceZ>;
32
+
33
+ export const BRIDGE_CONFIGS = ["FullBridge", "HalfBridge", "QuarterBridge"] as const;
34
+ export const bridgeConfigZ = z.enum(BRIDGE_CONFIGS);
35
+ export type BridgeConfig = z.infer<typeof bridgeConfigZ>;
36
+
37
+ export const ELECTRICAL_UNITS = ["mVoltsPerVolt", "VoltsPerVolt"] as const;
38
+ export const electricalUnitsZ = z.enum(ELECTRICAL_UNITS);
39
+ export type ElectricalUnits = z.infer<typeof electricalUnitsZ>;
40
+
41
+ export const RESISTANCE_CONFIGS = ["2Wire", "3Wire", "4Wire"] as const;
42
+ export const resistanceConfigZ = z.enum(RESISTANCE_CONFIGS);
43
+ export type ResistanceConfig = z.infer<typeof resistanceConfigZ>;
44
+
45
+ export const Z_INDEX_PHASES = [
46
+ "AHighBHigh",
47
+ "AHighBLow",
48
+ "ALowBHigh",
49
+ "ALowBLow",
50
+ ] as const;
51
+ export const zIndexPhaseZ = z.enum(Z_INDEX_PHASES);
52
+ export type ZIndexPhase = z.infer<typeof zIndexPhaseZ>;
53
+
54
+ export const UNITS = [
55
+ "Volts",
56
+ "Amps",
57
+ "DegF",
58
+ "DegC",
59
+ "DegR",
60
+ "Kelvins",
61
+ "Strain",
62
+ "Ohms",
63
+ "Hz",
64
+ "Seconds",
65
+ "Meters",
66
+ "Inches",
67
+ "Degrees",
68
+ "Radians",
69
+ "g",
70
+ "MetersPerSecondSquared",
71
+ "Newtons",
72
+ "Pounds",
73
+ "KilogramForce",
74
+ "PoundsPerSquareInch",
75
+ "Bar",
76
+ "Pascals",
77
+ "VoltsPerVolt",
78
+ "mVoltsPerVolt",
79
+ "NewtonMeters",
80
+ "InchPounds",
81
+ "InchOunces",
82
+ "FootPounds",
83
+ ] as const;
84
+ export const unitsZ = z.enum(UNITS);
85
+ export type Units = z.infer<typeof unitsZ>;
86
+
87
+ export const ACCEL_SENSITIVITY_UNITS = ["mVoltsPerG", "VoltsPerG"] as const;
88
+ export const accelSensitivityUnitsZ = z.enum(ACCEL_SENSITIVITY_UNITS);
89
+ export type AccelSensitivityUnits = z.infer<typeof accelSensitivityUnitsZ>;
90
+
91
+ export const ACCEL_UNITS = [
92
+ "g",
93
+ "MetersPerSecondSquared",
94
+ "InchesPerSecondSquared",
95
+ ] as const;
96
+ export const accelUnitsZ = z.enum(ACCEL_UNITS);
97
+ export type AccelUnits = z.infer<typeof accelUnitsZ>;
98
+
99
+ export const FORCE_UNITS = ["Newtons", "Pounds", "KilogramForce"] as const;
100
+ export const forceUnitsZ = z.enum(FORCE_UNITS);
101
+ export type ForceUnits = z.infer<typeof forceUnitsZ>;
102
+
103
+ export const SHUNT_RESISTOR_LOCATIONS = ["Default", "Internal", "External"] as const;
104
+ export const shuntResistorLocationZ = z.enum(SHUNT_RESISTOR_LOCATIONS);
105
+ export type ShuntResistorLocation = z.infer<typeof shuntResistorLocationZ>;
106
+
107
+ export const FORCE_SENSITIVITY_UNITS = ["mVoltsPerNewton", "mVoltsPerPound"] as const;
108
+ export const forceSensitivityUnitsZ = z.enum(FORCE_SENSITIVITY_UNITS);
109
+ export type ForceSensitivityUnits = z.infer<typeof forceSensitivityUnitsZ>;
110
+
111
+ export const PRESSURE_UNITS = ["PoundsPerSquareInch", "Pascals", "Bar"] as const;
112
+ export const pressureUnitsZ = z.enum(PRESSURE_UNITS);
113
+ export type PressureUnits = z.infer<typeof pressureUnitsZ>;
114
+
115
+ export const TORQUE_UNITS = [
116
+ "NewtonMeters",
117
+ "InchOunces",
118
+ "InchPounds",
119
+ "FootPounds",
120
+ ] as const;
121
+ export const torqueUnitsZ = z.enum(TORQUE_UNITS);
122
+ export type TorqueUnits = z.infer<typeof torqueUnitsZ>;
123
+
124
+ export const TEMPERATURE_UNITS = ["DegC", "DegF", "Kelvins", "DegR"] as const;
125
+ export const temperatureUnitsZ = z.enum(TEMPERATURE_UNITS);
126
+ export type TemperatureUnits = z.infer<typeof temperatureUnitsZ>;
127
+
128
+ export const RTD_TYPES = [
129
+ "Pt3750",
130
+ "Pt3851",
131
+ "Pt3911",
132
+ "Pt3916",
133
+ "Pt3920",
134
+ "Pt3928",
135
+ ] as const;
136
+ export const rtdTypeZ = z.enum(RTD_TYPES);
137
+ export type RTDType = z.infer<typeof rtdTypeZ>;
138
+
139
+ export const STRAIN_CONFIGS = [
140
+ "FullBridgeI",
141
+ "FullBridgeII",
142
+ "FullBridgeIII",
143
+ "HalfBridgeI",
144
+ "HalfBridgeII",
145
+ "QuarterBridgeI",
146
+ "QuarterBridgeII",
147
+ ] as const;
148
+ export const strainConfigZ = z.enum(STRAIN_CONFIGS);
149
+ export type StrainConfig = z.infer<typeof strainConfigZ>;
150
+
151
+ export const THERMOCOUPLE_TYPES = ["J", "K", "N", "R", "S", "T", "B", "E"] as const;
152
+ export const thermocoupleTypeZ = z.enum(THERMOCOUPLE_TYPES);
153
+ export type ThermocoupleType = z.infer<typeof thermocoupleTypeZ>;
154
+
155
+ export const VELOCITY_UNITS = ["MetersPerSecond", "InchesPerSecond"] as const;
156
+ export const velocityUnitsZ = z.enum(VELOCITY_UNITS);
157
+ export type VelocityUnits = z.infer<typeof velocityUnitsZ>;
158
+
159
+ export const VELOCITY_SENSITIVITY_UNITS = [
160
+ "MillivoltsPerMillimeterPerSecond",
161
+ "MilliVoltsPerInchPerSecond",
162
+ ] as const;
163
+ export const velocitySensitivityUnitsZ = z.enum(VELOCITY_SENSITIVITY_UNITS);
164
+ export type VelocitySensitivityUnits = z.infer<typeof velocitySensitivityUnitsZ>;
165
+
166
+ export const CHARGE_UNITS = ["Coulombs", "PicoCoulombs"] as const;
167
+ export const chargeUnitsZ = z.enum(CHARGE_UNITS);
168
+ export type ChargeUnits = z.infer<typeof chargeUnitsZ>;
169
+
170
+ export const CI_EDGES = ["Rising", "Falling"] as const;
171
+ export const ciEdgeZ = z.enum(CI_EDGES);
172
+ export type CIEdge = z.infer<typeof ciEdgeZ>;
173
+
174
+ export const CI_MEAS_METHODS = [
175
+ "LowFreq1Ctr",
176
+ "HighFreq2Ctr",
177
+ "LargeRng2Ctr",
178
+ "DynamicAvg",
179
+ ] as const;
180
+ export const ciMeasMethodZ = z.enum(CI_MEAS_METHODS);
181
+ export type CIMeasMethod = z.infer<typeof ciMeasMethodZ>;
182
+
183
+ export const CI_FREQ_UNITS = ["Hz", "Ticks"] as const;
184
+ export const ciFreqUnitsZ = z.enum(CI_FREQ_UNITS);
185
+ export type CIFreqUnits = z.infer<typeof ciFreqUnitsZ>;
186
+
187
+ export const CI_TIME_UNITS = ["Seconds", "Ticks"] as const;
188
+ export const ciTimeUnitsZ = z.enum(CI_TIME_UNITS);
189
+ export type CITimeUnits = z.infer<typeof ciTimeUnitsZ>;
190
+
191
+ export const CI_COUNT_DIRECTIONS = [
192
+ "CountUp",
193
+ "CountDown",
194
+ "ExternallyControlled",
195
+ ] as const;
196
+ export const ciCountDirectionZ = z.enum(CI_COUNT_DIRECTIONS);
197
+ export type CICountDirection = z.infer<typeof ciCountDirectionZ>;
198
+
199
+ export const CI_DECODING_TYPES = ["X1", "X2", "X4", "TwoPulse"] as const;
200
+ export const ciDecodingTypeZ = z.enum(CI_DECODING_TYPES);
201
+ export type CIDecodingType = z.infer<typeof ciDecodingTypeZ>;
202
+
203
+ export const CI_LINEAR_VELOCITY_UNITS = ["m/s", "in/s"] as const;
204
+ export const ciLinearVelocityUnitsZ = z.enum(CI_LINEAR_VELOCITY_UNITS);
205
+ export type CILinearVelocityUnits = z.infer<typeof ciLinearVelocityUnitsZ>;
206
+
207
+ export const CI_ANGULAR_VELOCITY_UNITS = ["RPM", "Radians/s", "Degrees/s"] as const;
208
+ export const ciAngularVelocityUnitsZ = z.enum(CI_ANGULAR_VELOCITY_UNITS);
209
+ export type CIAngularVelocityUnits = z.infer<typeof ciAngularVelocityUnitsZ>;
210
+
211
+ export const CI_LINEAR_POSITION_UNITS = ["Meters", "Inches", "Ticks"] as const;
212
+ export const ciLinearPositionUnitsZ = z.enum(CI_LINEAR_POSITION_UNITS);
213
+ export type CILinearPositionUnits = z.infer<typeof ciLinearPositionUnitsZ>;
214
+
215
+ export const CI_ANGULAR_POSITION_UNITS = ["Degrees", "Radians", "Ticks"] as const;
216
+ export const ciAngularPositionUnitsZ = z.enum(CI_ANGULAR_POSITION_UNITS);
217
+ export type CIAngularPositionUnits = z.infer<typeof ciAngularPositionUnitsZ>;
218
+
219
+ export const WAVE_TYPES = ["Sine", "Triangle", "Square", "Sawtooth"] as const;
220
+ export const waveTypeZ = z.enum(WAVE_TYPES);
221
+ export type WaveType = z.infer<typeof waveTypeZ>;
222
+
223
+ export const ACCEL_CHARGE_SENSITIVITY_UNITS = [
224
+ "PicoCoulombsPerG",
225
+ "PicoCoulombsPerMetersPerSecondSquared",
226
+ "PicoCoulombsPerInchesPerSecondSquared",
227
+ ] as const;
228
+ export const accelChargeSensitivityUnitsZ = z.enum(ACCEL_CHARGE_SENSITIVITY_UNITS);
229
+ export type AccelChargeSensitivityUnits = z.infer<typeof accelChargeSensitivityUnitsZ>;
230
+
231
+ /** MinMaxVal bounds the expected signal range in scaled units. */
232
+ export const minMaxValZ = z.object({
233
+ /** minVal is the minimum expected value, in scaled units. */
234
+ minVal: z.number().default(0),
235
+ /** maxVal is the maximum expected value, in scaled units. */
236
+ maxVal: z.number().default(1),
237
+ });
238
+ export interface MinMaxVal extends z.infer<typeof minMaxValZ> {}
239
+
240
+ /** Terminal configures the terminal wiring of an analog input channel. */
241
+ export const terminalZ = z.object({
242
+ /** terminalConfig selects the terminal configuration (RSE, NRSE, Diff, ...). */
243
+ terminalConfig: terminalConfigZ.default("Cfg_Default"),
244
+ });
245
+ export interface Terminal extends z.infer<typeof terminalZ> {}
246
+
247
+ /** Sensitivity specifies a sensor's sensitivity rating. */
248
+ export const sensitivityZ = z.object({
249
+ /** sensitivity is the sensor's sensitivity rating. */
250
+ sensitivity: z.number().default(0),
251
+ });
252
+ export interface Sensitivity extends z.infer<typeof sensitivityZ> {}
253
+
254
+ /** CurrentExcitation configures the current excitation supplied to a sensor. */
255
+ export const currentExcitationZ = z.object({
256
+ /** currentExcitSource selects the source of the current excitation signal. */
257
+ currentExcitSource: excitationSourceZ.default("Internal"),
258
+ /** currentExcitVal is the current excitation level, in Amps. */
259
+ currentExcitVal: z.number().default(0),
260
+ });
261
+ export interface CurrentExcitation extends z.infer<typeof currentExcitationZ> {}
262
+
263
+ /** VoltageExcitation configures the voltage excitation supplied to a sensor. */
264
+ export const voltageExcitationZ = z.object({
265
+ /** voltageExcitSource selects the source of the voltage excitation signal. */
266
+ voltageExcitSource: excitationSourceZ.default("Internal"),
267
+ /** voltageExcitVal is the voltage excitation level, in Volts. */
268
+ voltageExcitVal: z.number().default(0),
269
+ });
270
+ export interface VoltageExcitation extends z.infer<typeof voltageExcitationZ> {}
271
+
272
+ /** Bridge configures the wiring and nominal resistance of a bridge-based sensor. */
273
+ export const bridgeZ = z.object({
274
+ /** bridgeConfig selects the physical bridge wiring. */
275
+ bridgeConfig: bridgeConfigZ.default("FullBridge"),
276
+ /** nominalBridgeResistance is the nominal resistance of the bridge, in Ohms. */
277
+ nominalBridgeResistance: z.number().default(1),
278
+ });
279
+ export interface Bridge extends z.infer<typeof bridgeZ> {}
280
+
281
+ /**
282
+ * BridgePolynomial scales bridge electrical output to physical units with a polynomial.
283
+ */
284
+ export const bridgePolynomialZ = z.object({
285
+ /** forwardCoeffs are the coefficients mapping electrical to physical values. */
286
+ forwardCoeffs: z
287
+ .number()
288
+ .array()
289
+ .default(() => []),
290
+ /** reverseCoeffs are the coefficients mapping physical to electrical values. */
291
+ reverseCoeffs: z
292
+ .number()
293
+ .array()
294
+ .default(() => []),
295
+ /** electricalUnits are the electrical output units of the bridge. */
296
+ electricalUnits: electricalUnitsZ.default("mVoltsPerVolt"),
297
+ });
298
+ export interface BridgePolynomial extends z.infer<typeof bridgePolynomialZ> {}
299
+
300
+ /** Resistance configures the wiring of a resistance measurement. */
301
+ export const resistanceZ = z.object({
302
+ /**
303
+ * resistanceConfig selects the number of wires used for the resistance measurement.
304
+ */
305
+ resistanceConfig: resistanceConfigZ.default("2Wire"),
306
+ });
307
+ export interface Resistance extends z.infer<typeof resistanceZ> {}
308
+
309
+ /** Table scales bridge electrical output to physical units with a lookup table. */
310
+ export const tableZ = z.object({
311
+ /** electricalVals are the electrical breakpoints of the calibration table. */
312
+ electricalVals: z
313
+ .number()
314
+ .array()
315
+ .default(() => []),
316
+ /** electricalUnits are the units of the electrical breakpoints. */
317
+ electricalUnits: electricalUnitsZ.default("mVoltsPerVolt"),
318
+ /**
319
+ * physicalVals are the physical values corresponding to each electrical breakpoint.
320
+ */
321
+ physicalVals: z
322
+ .number()
323
+ .array()
324
+ .default(() => []),
325
+ });
326
+ export interface Table extends z.infer<typeof tableZ> {}
327
+
328
+ /**
329
+ * TwoPointLin scales bridge electrical output to physical units between two calibration
330
+ * points.
331
+ */
332
+ export const twoPointLinZ = z.object({
333
+ /** firstElectricalVal is the first electrical calibration point. */
334
+ firstElectricalVal: z.number().default(0),
335
+ /** secondElectricalVal is the second electrical calibration point. */
336
+ secondElectricalVal: z.number().default(1),
337
+ /** electricalUnits are the units of the electrical calibration points. */
338
+ electricalUnits: electricalUnitsZ.default("mVoltsPerVolt"),
339
+ /** firstPhysicalVal is the physical value at the first electrical point. */
340
+ firstPhysicalVal: z.number().default(0),
341
+ /** secondPhysicalVal is the physical value at the second electrical point. */
342
+ secondPhysicalVal: z.number().default(1),
343
+ });
344
+ export interface TwoPointLin extends z.infer<typeof twoPointLinZ> {}
345
+
346
+ /** BaseAIChannel carries the fields every NI analog input channel shares. */
347
+ export const baseAIChannelZ = z.object({
348
+ /** key uniquely identifies the channel within the task. */
349
+ key: z.string().default(id.create),
350
+ /** name is the human-readable channel name. */
351
+ name: z.string().default(""),
352
+ /** disabled is true when the channel is excluded from acquisition. */
353
+ disabled: z.boolean().default(false),
354
+ /** channel is the Synnax channel that raw samples are written to. */
355
+ channel: channel.keyZ.default(0),
356
+ /** port is the physical port the channel reads from. */
357
+ port: z.int32().default(0),
358
+ /** device is the key of the device the channel belongs to. */
359
+ device: device.keyZ.default(""),
360
+ });
361
+ export interface BaseAIChannel extends z.infer<typeof baseAIChannelZ> {}
362
+
363
+ /** ZIndex configures the Z-index reset behavior of an encoder. */
364
+ export const zIndexZ = z.object({
365
+ /** zIndexEnabled is true when the encoder's Z index resets the count. */
366
+ zIndexEnabled: z.boolean().default(false),
367
+ /** zIndexVal is the value the measurement resets to when the Z index is active. */
368
+ zIndexVal: z.number().default(0),
369
+ /** zIndexPhase selects the A/B states at which the Z index is active. */
370
+ zIndexPhase: zIndexPhaseZ.default("AHighBHigh"),
371
+ /** terminalZ is the terminal the Z index signal is wired to. */
372
+ terminalZ: z.string().default(""),
373
+ });
374
+ export interface ZIndex extends z.infer<typeof zIndexZ> {}
375
+
376
+ /** BaseCIChannel carries the fields every NI counter input channel shares. */
377
+ export const baseCIChannelZ = z.object({
378
+ /** key uniquely identifies the channel within the task. */
379
+ key: z.string().default(id.create),
380
+ /** name is the human-readable channel name. */
381
+ name: z.string().default(""),
382
+ /** disabled is true when the channel is excluded from acquisition. */
383
+ disabled: z.boolean().default(false),
384
+ /** channel is the Synnax channel that raw samples are written to. */
385
+ channel: channel.keyZ.default(0),
386
+ /** port is the physical counter the channel uses. */
387
+ port: z.int32().default(0),
388
+ /** device is the key of the device the counter belongs to. */
389
+ device: device.keyZ.default(""),
390
+ });
391
+ export interface BaseCIChannel extends z.infer<typeof baseCIChannelZ> {}
392
+
393
+ /** BaseAOChannel carries the fields every NI analog output channel shares. */
394
+ export const baseAOChannelZ = z.object({
395
+ /** key uniquely identifies the channel within the task. */
396
+ key: z.string().default(id.create),
397
+ /** disabled is true when the channel is excluded from the task. */
398
+ disabled: z.boolean().default(false),
399
+ /** cmdChannel is the Synnax channel commands are read from. */
400
+ cmdChannel: channel.keyZ.default(0),
401
+ /** stateChannel is the Synnax channel the output state is written to. */
402
+ stateChannel: channel.keyZ.default(0),
403
+ /** cmdChannelName is the human-readable name of the command channel. */
404
+ cmdChannelName: z.string().default(""),
405
+ /** stateChannelName is the human-readable name of the state channel. */
406
+ stateChannelName: z.string().default(""),
407
+ /** port is the physical port the channel writes to. */
408
+ port: z.int32().default(0),
409
+ });
410
+ export interface BaseAOChannel extends z.infer<typeof baseAOChannelZ> {}
411
+
412
+ /** DIChannel is a digital input channel the task acquires from. */
413
+ export const diChannelZ = z.object({
414
+ /** key uniquely identifies the channel within the task. */
415
+ key: z.string().default(id.create),
416
+ /** name is the human-readable channel name. */
417
+ name: z.string().default(""),
418
+ /** disabled is true when the channel is excluded from acquisition. */
419
+ disabled: z.boolean().default(false),
420
+ /** channel is the Synnax channel that raw samples are written to. */
421
+ channel: channel.keyZ.default(0),
422
+ /** port is the physical port the channel reads from. */
423
+ port: z.int32().default(0),
424
+ /** line is the digital line within the port the channel reads from. */
425
+ line: z.int32().default(0),
426
+ });
427
+ export interface DIChannel extends z.infer<typeof diChannelZ> {}
428
+
429
+ /** DOChannel is a digital output channel the task drives. */
430
+ export const doChannelZ = z.object({
431
+ /** key uniquely identifies the channel within the task. */
432
+ key: z.string().default(id.create),
433
+ /** disabled is true when the channel is excluded from the task. */
434
+ disabled: z.boolean().default(false),
435
+ /** cmdChannel is the Synnax channel commands are read from. */
436
+ cmdChannel: channel.keyZ.default(0),
437
+ /** stateChannel is the Synnax channel the output state is written to. */
438
+ stateChannel: channel.keyZ.default(0),
439
+ /** cmdChannelName is the human-readable name of the command channel. */
440
+ cmdChannelName: z.string().default(""),
441
+ /** stateChannelName is the human-readable name of the state channel. */
442
+ stateChannelName: z.string().default(""),
443
+ /** port is the physical port the channel writes to. */
444
+ port: z.int32().default(0),
445
+ /** line is the digital line within the port the channel writes to. */
446
+ line: z.int32().default(0),
447
+ });
448
+ export interface DOChannel extends z.infer<typeof doChannelZ> {}
449
+
450
+ export const writeConfigZ = task.writeConfigZ.extend({
451
+ stateRate: z.number().default(10),
452
+ });
453
+ export interface WriteConfig extends z.infer<typeof writeConfigZ> {}
454
+
455
+ export const scanConfigZ = task.scanConfigZ.extend({
456
+ ignoredModels: z.string().array().default(["^cRIO.*", "^nown.*"]),
457
+ });
458
+ export interface ScanConfig extends z.infer<typeof scanConfigZ> {}
459
+
460
+ /** BuiltInCJC reads the reference temperature from the device's own sensor. */
461
+ export const builtInCJCZ = z.object({
462
+ source: z.literal("built_in"),
463
+ });
464
+ export interface BuiltInCJC extends z.infer<typeof builtInCJCZ> {}
465
+
466
+ /** ConstValCJC uses a fixed reference temperature. */
467
+ export const constValCJCZ = z.object({
468
+ source: z.literal("const_val"),
469
+ /** val is the reference temperature, in the channel's units. */
470
+ val: z.number().default(0),
471
+ });
472
+ export interface ConstValCJC extends z.infer<typeof constValCJCZ> {}
473
+
474
+ /** ChanCJC reads the reference temperature from another channel. */
475
+ export const chanCJCZ = z.object({
476
+ source: z.literal("chan"),
477
+ /** port is the port of the channel that measures the reference. */
478
+ port: z.int32().default(0),
479
+ });
480
+ export interface ChanCJC extends z.infer<typeof chanCJCZ> {}
481
+
482
+ export const CJC_TYPES = ["built_in", "const_val", "chan"] as const;
483
+ export const cjcTypeZ = z.enum(CJC_TYPES);
484
+ export type CJCType = z.infer<typeof cjcTypeZ>;
485
+
486
+ /**
487
+ * CJC is the cold-junction compensation for a thermocouple. The source selects where
488
+ * the reference temperature comes from.
489
+ */
490
+ export const cjcZ = z.discriminatedUnion("source", [
491
+ builtInCJCZ,
492
+ constValCJCZ,
493
+ chanCJCZ,
494
+ ]);
495
+ export type CJC = BuiltInCJC | ConstValCJC | ChanCJC;
496
+
497
+ export const CJC_SCHEMAS: {
498
+ [K in CJCType]: z.ZodType<Extract<CJC, { source: K }>>;
499
+ } = {
500
+ built_in: builtInCJCZ,
501
+ const_val: constValCJCZ,
502
+ chan: chanCJCZ,
503
+ };
504
+
505
+ /** LinearScale maps raw values to engineering units with a slope and intercept. */
506
+ export const linearScaleZ = z.object({
507
+ type: z.literal("linear"),
508
+ /** slope is the multiplier applied to the raw value. */
509
+ slope: z.number().default(1),
510
+ /** yIntercept is the offset added after scaling. */
511
+ yIntercept: z.number().default(0),
512
+ /** preScaledUnits are the units of the raw value before scaling. */
513
+ preScaledUnits: unitsZ.default("Volts"),
514
+ /** scaledUnits are the units of the value after scaling. */
515
+ scaledUnits: z.string().default("Volts"),
516
+ });
517
+ export interface LinearScale extends z.infer<typeof linearScaleZ> {}
518
+
519
+ /** MapScale maps a raw range linearly onto a scaled range. */
520
+ export const mapScaleZ = z.object({
521
+ type: z.literal("map"),
522
+ /** preScaledMin is the lower bound of the raw input range. */
523
+ preScaledMin: z.number().default(0),
524
+ /** preScaledMax is the upper bound of the raw input range. */
525
+ preScaledMax: z.number().default(1),
526
+ /** scaledMin is the lower bound of the scaled output range. */
527
+ scaledMin: z.number().default(0),
528
+ /** scaledMax is the upper bound of the scaled output range. */
529
+ scaledMax: z.number().default(1),
530
+ /** preScaledUnits are the units of the raw value before scaling. */
531
+ preScaledUnits: unitsZ.default("Volts"),
532
+ /** scaledUnits are the units of the value after scaling. */
533
+ scaledUnits: z.string().default("Volts"),
534
+ });
535
+ export interface MapScale extends z.infer<typeof mapScaleZ> {}
536
+
537
+ /** TableScale maps raw values to engineering units via a lookup table. */
538
+ export const tableScaleZ = z.object({
539
+ type: z.literal("table"),
540
+ /** preScaledVals are the raw breakpoints, monotonically increasing. */
541
+ preScaledVals: z
542
+ .number()
543
+ .array()
544
+ .default(() => []),
545
+ /** scaledVals are the engineering-unit values at each breakpoint. */
546
+ scaledVals: z
547
+ .number()
548
+ .array()
549
+ .default(() => []),
550
+ /** preScaledUnits are the units of the raw values before scaling. */
551
+ preScaledUnits: unitsZ.default("Volts"),
552
+ /** scaledUnits are the units of the values after scaling. */
553
+ scaledUnits: z.string().default("Volts"),
554
+ });
555
+ export interface TableScale extends z.infer<typeof tableScaleZ> {}
556
+
557
+ /** PolynomialScale maps raw values to engineering units with a polynomial. */
558
+ export const polynomialScaleZ = z.object({
559
+ type: z.literal("polynomial"),
560
+ /** forwardCoeffs are the coefficients mapping pre-scaled to scaled values. */
561
+ forwardCoeffs: z
562
+ .number()
563
+ .array()
564
+ .default(() => []),
565
+ /** reverseCoeffs are the coefficients mapping scaled to pre-scaled values. */
566
+ reverseCoeffs: z
567
+ .number()
568
+ .array()
569
+ .default(() => []),
570
+ /** preScaledUnits are the units of the raw value before scaling. */
571
+ preScaledUnits: unitsZ.default("Volts"),
572
+ /** scaledUnits are the units of the value after scaling. */
573
+ scaledUnits: z.string().default("Volts"),
574
+ });
575
+ export interface PolynomialScale extends z.infer<typeof polynomialScaleZ> {}
576
+
577
+ /** NoneScale applies no scaling; the raw value is used directly. */
578
+ export const noneScaleZ = z.object({
579
+ type: z.literal("none"),
580
+ });
581
+ export interface NoneScale extends z.infer<typeof noneScaleZ> {}
582
+
583
+ export const SCALE_TYPES = ["linear", "map", "table", "polynomial", "none"] as const;
584
+ export const scaleTypeZ = z.enum(SCALE_TYPES);
585
+ export type ScaleType = z.infer<typeof scaleTypeZ>;
586
+
587
+ /** Scale determines how raw sensor values are transformed to engineering units. */
588
+ export const scaleZ = z.discriminatedUnion("type", [
589
+ linearScaleZ,
590
+ mapScaleZ,
591
+ tableScaleZ,
592
+ polynomialScaleZ,
593
+ noneScaleZ,
594
+ ]);
595
+ export type Scale = LinearScale | MapScale | TableScale | PolynomialScale | NoneScale;
596
+
597
+ export const SCALE_SCHEMAS: {
598
+ [K in ScaleType]: z.ZodType<Extract<Scale, { type: K }>>;
599
+ } = {
600
+ linear: linearScaleZ,
601
+ map: mapScaleZ,
602
+ table: tableScaleZ,
603
+ polynomial: polynomialScaleZ,
604
+ none: noneScaleZ,
605
+ };
606
+
607
+ export const digitalReadConfigZ = task.readConfigZ.extend({
608
+ device: device.keyZ.default(""),
609
+ channels: diChannelZ.array().default(() => []),
610
+ });
611
+ export interface DigitalReadConfig extends z.infer<typeof digitalReadConfigZ> {}
612
+
613
+ export const digitalWriteConfigZ = writeConfigZ.extend({
614
+ channels: doChannelZ.array().default(() => []),
615
+ });
616
+ export interface DigitalWriteConfig extends z.infer<typeof digitalWriteConfigZ> {}
617
+
618
+ /** CustomScale applies a user-defined scale to the raw measurement. */
619
+ export const customScaleZ = z.object({
620
+ /** customScale is the scale applied to the raw measurement. */
621
+ customScale: scaleZ.prefault({ type: "none" }),
622
+ });
623
+ export interface CustomScale extends z.infer<typeof customScaleZ> {}
624
+
625
+ /** AIVoltageChannel reads a voltage. */
626
+ export const aiVoltageChannelZ = baseAIChannelZ
627
+ .extend(minMaxValZ.shape)
628
+ .extend(terminalZ.shape)
629
+ .extend(customScaleZ.shape)
630
+ .extend({
631
+ type: z.literal("ai_voltage"),
632
+ });
633
+ export interface AIVoltageChannel extends z.infer<typeof aiVoltageChannelZ> {}
634
+
635
+ /** AIAccelChannel reads acceleration from an accelerometer. */
636
+ export const aiAccelChannelZ = baseAIChannelZ
637
+ .extend(minMaxValZ.shape)
638
+ .extend(terminalZ.shape)
639
+ .extend(sensitivityZ.shape)
640
+ .extend(currentExcitationZ.shape)
641
+ .extend(customScaleZ.shape)
642
+ .extend({
643
+ type: z.literal("ai_accel"),
644
+ /** units are the units of the acceleration measurement. */
645
+ units: accelUnitsZ.default("g"),
646
+ /** sensitivityUnits are the units of the accelerometer sensitivity. */
647
+ sensitivityUnits: accelSensitivityUnitsZ.default("mVoltsPerG"),
648
+ });
649
+ export interface AIAccelChannel extends z.infer<typeof aiAccelChannelZ> {}
650
+
651
+ /** AIBridgeChannel reads a generic bridge-based sensor. */
652
+ export const aiBridgeChannelZ = baseAIChannelZ
653
+ .extend(minMaxValZ.shape)
654
+ .extend(bridgeZ.shape)
655
+ .extend(voltageExcitationZ.shape)
656
+ .extend(customScaleZ.shape)
657
+ .extend({
658
+ type: z.literal("ai_bridge"),
659
+ /** units are the electrical output units of the bridge. */
660
+ units: electricalUnitsZ.default("mVoltsPerVolt"),
661
+ });
662
+ export interface AIBridgeChannel extends z.infer<typeof aiBridgeChannelZ> {}
663
+
664
+ /** AICurrentChannel reads a current. */
665
+ export const aiCurrentChannelZ = baseAIChannelZ
666
+ .extend(minMaxValZ.shape)
667
+ .extend(terminalZ.shape)
668
+ .extend(customScaleZ.shape)
669
+ .extend({
670
+ type: z.literal("ai_current"),
671
+ /** shuntResistorLoc selects where the shunt resistor is located. */
672
+ shuntResistorLoc: shuntResistorLocationZ.default("Default"),
673
+ /** extShuntResistorVal is the external shunt resistor value, in Ohms. */
674
+ extShuntResistorVal: z.number().default(1),
675
+ });
676
+ export interface AICurrentChannel extends z.infer<typeof aiCurrentChannelZ> {}
677
+
678
+ /** AIForceBridgeTableChannel reads force from a bridge with a calibration table. */
679
+ export const aiForceBridgeTableChannelZ = baseAIChannelZ
680
+ .extend(minMaxValZ.shape)
681
+ .extend(bridgeZ.shape)
682
+ .extend(voltageExcitationZ.shape)
683
+ .extend(tableZ.shape)
684
+ .extend(customScaleZ.shape)
685
+ .extend({
686
+ type: z.literal("ai_force_bridge_table"),
687
+ /** units are the units of the force measurement. */
688
+ units: forceUnitsZ.default("Newtons"),
689
+ /** physicalUnits are the physical units of the calibration table. */
690
+ physicalUnits: forceUnitsZ.default("Newtons"),
691
+ });
692
+ export interface AIForceBridgeTableChannel extends z.infer<
693
+ typeof aiForceBridgeTableChannelZ
694
+ > {}
695
+
696
+ /**
697
+ * AIForceBridgeTwoPointLinChannel reads force from a bridge with two-point linear
698
+ * calibration.
699
+ */
700
+ export const aiForceBridgeTwoPointLinChannelZ = baseAIChannelZ
701
+ .extend(minMaxValZ.shape)
702
+ .extend(bridgeZ.shape)
703
+ .extend(voltageExcitationZ.shape)
704
+ .extend(twoPointLinZ.shape)
705
+ .extend(customScaleZ.shape)
706
+ .extend({
707
+ type: z.literal("ai_force_bridge_two_point_lin"),
708
+ /** units are the units of the force measurement. */
709
+ units: forceUnitsZ.default("Newtons"),
710
+ /** physicalUnits are the physical units of the two-point calibration. */
711
+ physicalUnits: forceUnitsZ.default("Newtons"),
712
+ });
713
+ export interface AIForceBridgeTwoPointLinChannel extends z.infer<
714
+ typeof aiForceBridgeTwoPointLinChannelZ
715
+ > {}
716
+
717
+ /** AIForceIEPEChannel reads force from an IEPE sensor. */
718
+ export const aiForceIEPEChannelZ = baseAIChannelZ
719
+ .extend(minMaxValZ.shape)
720
+ .extend(terminalZ.shape)
721
+ .extend(sensitivityZ.shape)
722
+ .extend(currentExcitationZ.shape)
723
+ .extend(customScaleZ.shape)
724
+ .extend({
725
+ type: z.literal("ai_force_iepe"),
726
+ /** units are the units of the force measurement. */
727
+ units: forceUnitsZ.default("Newtons"),
728
+ /** sensitivityUnits are the units of the IEPE sensor sensitivity. */
729
+ sensitivityUnits: forceSensitivityUnitsZ.default("mVoltsPerNewton"),
730
+ });
731
+ export interface AIForceIEPEChannel extends z.infer<typeof aiForceIEPEChannelZ> {}
732
+
733
+ /** AIMicrophoneChannel reads sound pressure from a microphone. */
734
+ export const aiMicrophoneChannelZ = baseAIChannelZ
735
+ .extend(terminalZ.shape)
736
+ .extend(currentExcitationZ.shape)
737
+ .extend(customScaleZ.shape)
738
+ .extend({
739
+ type: z.literal("ai_microphone"),
740
+ /** micSensitivity is the microphone sensitivity, in mV/Pa. */
741
+ micSensitivity: z.number().default(0),
742
+ /** maxSndPressLevel is the maximum expected sound pressure level, in dB. */
743
+ maxSndPressLevel: z.number().default(0),
744
+ });
745
+ export interface AIMicrophoneChannel extends z.infer<typeof aiMicrophoneChannelZ> {}
746
+
747
+ /**
748
+ * AIPressureBridgeTableChannel reads pressure from a bridge with a calibration table.
749
+ */
750
+ export const aiPressureBridgeTableChannelZ = baseAIChannelZ
751
+ .extend(minMaxValZ.shape)
752
+ .extend(bridgeZ.shape)
753
+ .extend(voltageExcitationZ.shape)
754
+ .extend(tableZ.shape)
755
+ .extend(customScaleZ.shape)
756
+ .extend({
757
+ type: z.literal("ai_pressure_bridge_table"),
758
+ /** units are the units of the pressure measurement. */
759
+ units: pressureUnitsZ.default("PoundsPerSquareInch"),
760
+ /** physicalUnits are the physical units of the calibration table. */
761
+ physicalUnits: pressureUnitsZ.default("PoundsPerSquareInch"),
762
+ });
763
+ export interface AIPressureBridgeTableChannel extends z.infer<
764
+ typeof aiPressureBridgeTableChannelZ
765
+ > {}
766
+
767
+ /**
768
+ * AIPressureBridgeTwoPointLinChannel reads pressure from a bridge with two-point linear
769
+ * calibration.
770
+ */
771
+ export const aiPressureBridgeTwoPointLinChannelZ = baseAIChannelZ
772
+ .extend(minMaxValZ.shape)
773
+ .extend(bridgeZ.shape)
774
+ .extend(voltageExcitationZ.shape)
775
+ .extend(twoPointLinZ.shape)
776
+ .extend(customScaleZ.shape)
777
+ .extend({
778
+ type: z.literal("ai_pressure_bridge_two_point_lin"),
779
+ /** units are the units of the pressure measurement. */
780
+ units: pressureUnitsZ.default("PoundsPerSquareInch"),
781
+ /** physicalUnits are the physical units of the two-point calibration. */
782
+ physicalUnits: pressureUnitsZ.default("PoundsPerSquareInch"),
783
+ });
784
+ export interface AIPressureBridgeTwoPointLinChannel extends z.infer<
785
+ typeof aiPressureBridgeTwoPointLinChannelZ
786
+ > {}
787
+
788
+ /** AIResistanceChannel reads a resistance. */
789
+ export const aiResistanceChannelZ = baseAIChannelZ
790
+ .extend(minMaxValZ.shape)
791
+ .extend(resistanceZ.shape)
792
+ .extend(currentExcitationZ.shape)
793
+ .extend(customScaleZ.shape)
794
+ .extend({
795
+ type: z.literal("ai_resistance"),
796
+ });
797
+ export interface AIResistanceChannel extends z.infer<typeof aiResistanceChannelZ> {}
798
+
799
+ /** AIRTDChannel reads temperature from an RTD. */
800
+ export const aiRTDChannelZ = baseAIChannelZ
801
+ .extend(minMaxValZ.shape)
802
+ .extend(resistanceZ.shape)
803
+ .extend(currentExcitationZ.shape)
804
+ .extend({
805
+ type: z.literal("ai_rtd"),
806
+ /** units are the units of the temperature measurement. */
807
+ units: temperatureUnitsZ.default("DegC"),
808
+ /** rtdType selects the RTD resistance-temperature curve. */
809
+ rtdType: rtdTypeZ.default("Pt3750"),
810
+ /** r0 is the sensor resistance at 0 degrees Celsius, in Ohms. */
811
+ r0: z.number().default(0),
812
+ });
813
+ export interface AIRTDChannel extends z.infer<typeof aiRTDChannelZ> {}
814
+
815
+ /** AIStrainGaugeChannel reads strain from a strain gauge. */
816
+ export const aiStrainGaugeChannelZ = baseAIChannelZ
817
+ .extend(minMaxValZ.shape)
818
+ .extend(voltageExcitationZ.shape)
819
+ .extend(customScaleZ.shape)
820
+ .extend({
821
+ type: z.literal("ai_strain_gauge"),
822
+ /** strainConfig selects the strain-gauge bridge configuration. */
823
+ strainConfig: strainConfigZ.default("FullBridgeI"),
824
+ /** gageFactor is the gauge factor of the strain gauge. */
825
+ gageFactor: z.number().default(0),
826
+ /** initialBridgeVoltage is the bridge output voltage in the unloaded state. */
827
+ initialBridgeVoltage: z.number().default(0),
828
+ /** nominalGageResistance is the nominal gauge resistance, in Ohms. */
829
+ nominalGageResistance: z.number().default(0),
830
+ /** poissonRatio is the Poisson ratio of the measured material. */
831
+ poissonRatio: z.number().default(0),
832
+ /** leadWireResistance is the resistance of the lead wires, in Ohms. */
833
+ leadWireResistance: z.number().default(0),
834
+ });
835
+ export interface AIStrainGaugeChannel extends z.infer<typeof aiStrainGaugeChannelZ> {}
836
+
837
+ /** AITempBuiltinChannel reads temperature from the device's built-in sensor. */
838
+ export const aiTempBuiltinChannelZ = baseAIChannelZ.omit({ port: true }).extend({
839
+ type: z.literal("ai_temp_builtin"),
840
+ /** units are the units of the temperature measurement. */
841
+ units: temperatureUnitsZ.default("DegC"),
842
+ });
843
+ export interface AITempBuiltinChannel extends z.infer<typeof aiTempBuiltinChannelZ> {}
844
+
845
+ /** AIThermocoupleChannel reads temperature from a thermocouple. */
846
+ export const aiThermocoupleChannelZ = baseAIChannelZ.extend(minMaxValZ.shape).extend({
847
+ type: z.literal("ai_thermocouple"),
848
+ /** units are the units of the temperature measurement. */
849
+ units: temperatureUnitsZ.default("DegC"),
850
+ /** thermocoupleType selects the thermocouple alloy type. */
851
+ thermocoupleType: thermocoupleTypeZ.default("J"),
852
+ /** cjc is the cold-junction compensation applied to the reading. */
853
+ cjc: cjcZ.prefault({ source: "built_in" }),
854
+ });
855
+ export interface AIThermocoupleChannel extends z.infer<typeof aiThermocoupleChannelZ> {}
856
+
857
+ /** AITorqueBridgeTableChannel reads torque from a bridge with a calibration table. */
858
+ export const aiTorqueBridgeTableChannelZ = baseAIChannelZ
859
+ .extend(minMaxValZ.shape)
860
+ .extend(bridgeZ.shape)
861
+ .extend(voltageExcitationZ.shape)
862
+ .extend(tableZ.shape)
863
+ .extend(customScaleZ.shape)
864
+ .extend({
865
+ type: z.literal("ai_torque_bridge_table"),
866
+ /** units are the units of the torque measurement. */
867
+ units: torqueUnitsZ.default("NewtonMeters"),
868
+ /** physicalUnits are the physical units of the calibration table. */
869
+ physicalUnits: torqueUnitsZ.default("NewtonMeters"),
870
+ });
871
+ export interface AITorqueBridgeTableChannel extends z.infer<
872
+ typeof aiTorqueBridgeTableChannelZ
873
+ > {}
874
+
875
+ /**
876
+ * AITorqueBridgeTwoPointLinChannel reads torque from a bridge with two-point linear
877
+ * calibration.
878
+ */
879
+ export const aiTorqueBridgeTwoPointLinChannelZ = baseAIChannelZ
880
+ .extend(minMaxValZ.shape)
881
+ .extend(bridgeZ.shape)
882
+ .extend(voltageExcitationZ.shape)
883
+ .extend(twoPointLinZ.shape)
884
+ .extend(customScaleZ.shape)
885
+ .extend({
886
+ type: z.literal("ai_torque_bridge_two_point_lin"),
887
+ /** units are the units of the torque measurement. */
888
+ units: torqueUnitsZ.default("NewtonMeters"),
889
+ /** physicalUnits are the physical units of the two-point calibration. */
890
+ physicalUnits: torqueUnitsZ.default("NewtonMeters"),
891
+ });
892
+ export interface AITorqueBridgeTwoPointLinChannel extends z.infer<
893
+ typeof aiTorqueBridgeTwoPointLinChannelZ
894
+ > {}
895
+
896
+ /** AIVelocityIEPEChannel reads velocity from an IEPE sensor. */
897
+ export const aiVelocityIEPEChannelZ = baseAIChannelZ
898
+ .extend(minMaxValZ.shape)
899
+ .extend(terminalZ.shape)
900
+ .extend(sensitivityZ.shape)
901
+ .extend(currentExcitationZ.shape)
902
+ .extend(customScaleZ.shape)
903
+ .extend({
904
+ type: z.literal("ai_velocity_iepe"),
905
+ /** units are the units of the velocity measurement. */
906
+ units: velocityUnitsZ.default("MetersPerSecond"),
907
+ /** sensitivityUnits are the units of the IEPE sensor sensitivity. */
908
+ sensitivityUnits: velocitySensitivityUnitsZ.default(
909
+ "MillivoltsPerMillimeterPerSecond",
910
+ ),
911
+ });
912
+ export interface AIVelocityIEPEChannel extends z.infer<typeof aiVelocityIEPEChannelZ> {}
913
+
914
+ /**
915
+ * AIAccel4WireDCVoltageChannel reads acceleration from a 4-wire DC-voltage
916
+ * accelerometer.
917
+ */
918
+ export const aiAccel4WireDCVoltageChannelZ = baseAIChannelZ
919
+ .extend(minMaxValZ.shape)
920
+ .extend(terminalZ.shape)
921
+ .extend(sensitivityZ.shape)
922
+ .extend(voltageExcitationZ.shape)
923
+ .extend(customScaleZ.shape)
924
+ .extend({
925
+ type: z.literal("ai_accel_4_wire_dc_voltage"),
926
+ /** units are the units of the acceleration measurement. */
927
+ units: accelUnitsZ.default("g"),
928
+ /** sensitivityUnits are the units of the accelerometer sensitivity. */
929
+ sensitivityUnits: accelSensitivityUnitsZ.default("mVoltsPerG"),
930
+ /**
931
+ * scaledByExcitation is true when the excitation voltage is used to scale the
932
+ * reading.
933
+ */
934
+ scaledByExcitation: z.boolean().default(false),
935
+ });
936
+ export interface AIAccel4WireDCVoltageChannel extends z.infer<
937
+ typeof aiAccel4WireDCVoltageChannelZ
938
+ > {}
939
+
940
+ /** AIAccelChargeChannel reads acceleration from a charge-mode accelerometer. */
941
+ export const aiAccelChargeChannelZ = baseAIChannelZ
942
+ .extend(minMaxValZ.shape)
943
+ .extend(terminalZ.shape)
944
+ .extend(sensitivityZ.shape)
945
+ .extend(customScaleZ.shape)
946
+ .extend({
947
+ type: z.literal("ai_accel_charge"),
948
+ /** units are the units of the acceleration measurement. */
949
+ units: accelUnitsZ.default("g"),
950
+ /** sensitivityUnits are the units of the accelerometer sensitivity. */
951
+ sensitivityUnits: accelChargeSensitivityUnitsZ.default("PicoCoulombsPerG"),
952
+ });
953
+ export interface AIAccelChargeChannel extends z.infer<typeof aiAccelChargeChannelZ> {}
954
+
955
+ /** AIChargeChannel reads a raw charge. */
956
+ export const aiChargeChannelZ = baseAIChannelZ
957
+ .extend(minMaxValZ.shape)
958
+ .extend(terminalZ.shape)
959
+ .extend(customScaleZ.shape)
960
+ .extend({
961
+ type: z.literal("ai_charge"),
962
+ /** units are the units of the charge measurement. */
963
+ units: chargeUnitsZ.default("Coulombs"),
964
+ });
965
+ export interface AIChargeChannel extends z.infer<typeof aiChargeChannelZ> {}
966
+
967
+ /** AICurrentRMSChannel reads RMS current. */
968
+ export const aiCurrentRMSChannelZ = baseAIChannelZ
969
+ .extend(minMaxValZ.shape)
970
+ .extend(terminalZ.shape)
971
+ .extend(customScaleZ.shape)
972
+ .extend({
973
+ type: z.literal("ai_current_rms"),
974
+ /** shuntResistorLoc selects where the shunt resistor is located. */
975
+ shuntResistorLoc: shuntResistorLocationZ.default("Default"),
976
+ /** extShuntResistorVal is the external shunt resistor value, in Ohms. */
977
+ extShuntResistorVal: z.number().default(1),
978
+ });
979
+ export interface AICurrentRMSChannel extends z.infer<typeof aiCurrentRMSChannelZ> {}
980
+
981
+ /**
982
+ * AIForceBridgePolynomialChannel reads force from a bridge with polynomial calibration.
983
+ */
984
+ export const aiForceBridgePolynomialChannelZ = baseAIChannelZ
985
+ .extend(minMaxValZ.shape)
986
+ .extend(bridgeZ.shape)
987
+ .extend(voltageExcitationZ.shape)
988
+ .extend(bridgePolynomialZ.shape)
989
+ .extend(customScaleZ.shape)
990
+ .extend({
991
+ type: z.literal("ai_force_bridge_polynomial"),
992
+ /** units are the units of the force measurement. */
993
+ units: forceUnitsZ.default("Newtons"),
994
+ /** physicalUnits are the physical units of the polynomial calibration. */
995
+ physicalUnits: forceUnitsZ.default("Newtons"),
996
+ });
997
+ export interface AIForceBridgePolynomialChannel extends z.infer<
998
+ typeof aiForceBridgePolynomialChannelZ
999
+ > {}
1000
+
1001
+ /** AIFreqVoltageChannel reads frequency from a voltage signal. */
1002
+ export const aiFreqVoltageChannelZ = baseAIChannelZ
1003
+ .extend(minMaxValZ.shape)
1004
+ .extend(customScaleZ.shape)
1005
+ .extend({
1006
+ type: z.literal("ai_freq_voltage"),
1007
+ /** thresholdLevel is the voltage level at which a cycle is counted. */
1008
+ thresholdLevel: z.number().default(0),
1009
+ /** hysteresis is the hysteresis applied around the threshold level. */
1010
+ hysteresis: z.number().default(0),
1011
+ });
1012
+ export interface AIFreqVoltageChannel extends z.infer<typeof aiFreqVoltageChannelZ> {}
1013
+
1014
+ /**
1015
+ * AIPressureBridgePolynomialChannel reads pressure from a bridge with polynomial
1016
+ * calibration.
1017
+ */
1018
+ export const aiPressureBridgePolynomialChannelZ = baseAIChannelZ
1019
+ .extend(minMaxValZ.shape)
1020
+ .extend(bridgeZ.shape)
1021
+ .extend(voltageExcitationZ.shape)
1022
+ .extend(bridgePolynomialZ.shape)
1023
+ .extend(customScaleZ.shape)
1024
+ .extend({
1025
+ type: z.literal("ai_pressure_bridge_polynomial"),
1026
+ /** units are the units of the pressure measurement. */
1027
+ units: pressureUnitsZ.default("PoundsPerSquareInch"),
1028
+ /** physicalUnits are the physical units of the polynomial calibration. */
1029
+ physicalUnits: pressureUnitsZ.default("PoundsPerSquareInch"),
1030
+ });
1031
+ export interface AIPressureBridgePolynomialChannel extends z.infer<
1032
+ typeof aiPressureBridgePolynomialChannelZ
1033
+ > {}
1034
+
1035
+ /** AIThermistorIexChannel reads temperature from a current-excited thermistor. */
1036
+ export const aiThermistorIexChannelZ = baseAIChannelZ
1037
+ .extend(minMaxValZ.shape)
1038
+ .extend(resistanceZ.shape)
1039
+ .extend(currentExcitationZ.shape)
1040
+ .extend({
1041
+ type: z.literal("ai_thermistor_iex"),
1042
+ /** units are the units of the temperature measurement. */
1043
+ units: temperatureUnitsZ.default("DegC"),
1044
+ /** a is the first Steinhart-Hart coefficient. */
1045
+ a: z.number().default(0),
1046
+ /** b is the second Steinhart-Hart coefficient. */
1047
+ b: z.number().default(0),
1048
+ /** c is the third Steinhart-Hart coefficient. */
1049
+ c: z.number().default(0),
1050
+ });
1051
+ export interface AIThermistorIexChannel extends z.infer<
1052
+ typeof aiThermistorIexChannelZ
1053
+ > {}
1054
+
1055
+ /** AIThermistorVexChannel reads temperature from a voltage-excited thermistor. */
1056
+ export const aiThermistorVexChannelZ = baseAIChannelZ
1057
+ .extend(minMaxValZ.shape)
1058
+ .extend(resistanceZ.shape)
1059
+ .extend(voltageExcitationZ.shape)
1060
+ .extend({
1061
+ type: z.literal("ai_thermistor_vex"),
1062
+ /** units are the units of the temperature measurement. */
1063
+ units: temperatureUnitsZ.default("DegC"),
1064
+ /** a is the first Steinhart-Hart coefficient. */
1065
+ a: z.number().default(0),
1066
+ /** b is the second Steinhart-Hart coefficient. */
1067
+ b: z.number().default(0),
1068
+ /** c is the third Steinhart-Hart coefficient. */
1069
+ c: z.number().default(0),
1070
+ /** r1 is the reference resistor value, in Ohms. */
1071
+ r1: z.number().default(0),
1072
+ });
1073
+ export interface AIThermistorVexChannel extends z.infer<
1074
+ typeof aiThermistorVexChannelZ
1075
+ > {}
1076
+
1077
+ /**
1078
+ * AITorqueBridgePolynomialChannel reads torque from a bridge with polynomial
1079
+ * calibration.
1080
+ */
1081
+ export const aiTorqueBridgePolynomialChannelZ = baseAIChannelZ
1082
+ .extend(minMaxValZ.shape)
1083
+ .extend(bridgeZ.shape)
1084
+ .extend(voltageExcitationZ.shape)
1085
+ .extend(bridgePolynomialZ.shape)
1086
+ .extend(customScaleZ.shape)
1087
+ .extend({
1088
+ type: z.literal("ai_torque_bridge_polynomial"),
1089
+ /** units are the units of the torque measurement. */
1090
+ units: torqueUnitsZ.default("NewtonMeters"),
1091
+ /** physicalUnits are the physical units of the polynomial calibration. */
1092
+ physicalUnits: torqueUnitsZ.default("NewtonMeters"),
1093
+ });
1094
+ export interface AITorqueBridgePolynomialChannel extends z.infer<
1095
+ typeof aiTorqueBridgePolynomialChannelZ
1096
+ > {}
1097
+
1098
+ /** AIVoltageRMSChannel reads RMS voltage. */
1099
+ export const aiVoltageRMSChannelZ = baseAIChannelZ
1100
+ .extend(minMaxValZ.shape)
1101
+ .extend(terminalZ.shape)
1102
+ .extend(customScaleZ.shape)
1103
+ .extend({
1104
+ type: z.literal("ai_voltage_rms"),
1105
+ });
1106
+ export interface AIVoltageRMSChannel extends z.infer<typeof aiVoltageRMSChannelZ> {}
1107
+
1108
+ /** AIVoltageWithExcitChannel reads a voltage with excitation. */
1109
+ export const aiVoltageWithExcitChannelZ = baseAIChannelZ
1110
+ .extend(minMaxValZ.shape)
1111
+ .extend(terminalZ.shape)
1112
+ .extend(voltageExcitationZ.shape)
1113
+ .extend(customScaleZ.shape)
1114
+ .extend({
1115
+ type: z.literal("ai_voltage_with_excit"),
1116
+ /** bridgeConfig selects the physical bridge wiring. */
1117
+ bridgeConfig: bridgeConfigZ.default("FullBridge"),
1118
+ /**
1119
+ * scaledByExcitation is true when the excitation voltage is used to scale the
1120
+ * reading.
1121
+ */
1122
+ scaledByExcitation: z.boolean().default(false),
1123
+ });
1124
+ export interface AIVoltageWithExcitChannel extends z.infer<
1125
+ typeof aiVoltageWithExcitChannelZ
1126
+ > {}
1127
+
1128
+ export const AI_CHANNEL_TYPES = [
1129
+ "ai_voltage",
1130
+ "ai_accel",
1131
+ "ai_bridge",
1132
+ "ai_current",
1133
+ "ai_force_bridge_table",
1134
+ "ai_force_bridge_two_point_lin",
1135
+ "ai_force_iepe",
1136
+ "ai_microphone",
1137
+ "ai_pressure_bridge_table",
1138
+ "ai_pressure_bridge_two_point_lin",
1139
+ "ai_resistance",
1140
+ "ai_rtd",
1141
+ "ai_strain_gauge",
1142
+ "ai_temp_builtin",
1143
+ "ai_thermocouple",
1144
+ "ai_torque_bridge_table",
1145
+ "ai_torque_bridge_two_point_lin",
1146
+ "ai_velocity_iepe",
1147
+ "ai_accel_4_wire_dc_voltage",
1148
+ "ai_accel_charge",
1149
+ "ai_charge",
1150
+ "ai_current_rms",
1151
+ "ai_force_bridge_polynomial",
1152
+ "ai_freq_voltage",
1153
+ "ai_pressure_bridge_polynomial",
1154
+ "ai_thermistor_iex",
1155
+ "ai_thermistor_vex",
1156
+ "ai_torque_bridge_polynomial",
1157
+ "ai_voltage_rms",
1158
+ "ai_voltage_with_excit",
1159
+ ] as const;
1160
+ export const aiChannelTypeZ = z.enum(AI_CHANNEL_TYPES);
1161
+ export type AIChannelType = z.infer<typeof aiChannelTypeZ>;
1162
+
1163
+ /**
1164
+ * AIChannel is a single NI analog input channel. The type field selects the measurement
1165
+ * mode and the fields that accompany it.
1166
+ */
1167
+ export const aiChannelZ = z.discriminatedUnion("type", [
1168
+ aiVoltageChannelZ,
1169
+ aiAccelChannelZ,
1170
+ aiBridgeChannelZ,
1171
+ aiCurrentChannelZ,
1172
+ aiForceBridgeTableChannelZ,
1173
+ aiForceBridgeTwoPointLinChannelZ,
1174
+ aiForceIEPEChannelZ,
1175
+ aiMicrophoneChannelZ,
1176
+ aiPressureBridgeTableChannelZ,
1177
+ aiPressureBridgeTwoPointLinChannelZ,
1178
+ aiResistanceChannelZ,
1179
+ aiRTDChannelZ,
1180
+ aiStrainGaugeChannelZ,
1181
+ aiTempBuiltinChannelZ,
1182
+ aiThermocoupleChannelZ,
1183
+ aiTorqueBridgeTableChannelZ,
1184
+ aiTorqueBridgeTwoPointLinChannelZ,
1185
+ aiVelocityIEPEChannelZ,
1186
+ aiAccel4WireDCVoltageChannelZ,
1187
+ aiAccelChargeChannelZ,
1188
+ aiChargeChannelZ,
1189
+ aiCurrentRMSChannelZ,
1190
+ aiForceBridgePolynomialChannelZ,
1191
+ aiFreqVoltageChannelZ,
1192
+ aiPressureBridgePolynomialChannelZ,
1193
+ aiThermistorIexChannelZ,
1194
+ aiThermistorVexChannelZ,
1195
+ aiTorqueBridgePolynomialChannelZ,
1196
+ aiVoltageRMSChannelZ,
1197
+ aiVoltageWithExcitChannelZ,
1198
+ ]);
1199
+ export type AIChannel =
1200
+ | AIVoltageChannel
1201
+ | AIAccelChannel
1202
+ | AIBridgeChannel
1203
+ | AICurrentChannel
1204
+ | AIForceBridgeTableChannel
1205
+ | AIForceBridgeTwoPointLinChannel
1206
+ | AIForceIEPEChannel
1207
+ | AIMicrophoneChannel
1208
+ | AIPressureBridgeTableChannel
1209
+ | AIPressureBridgeTwoPointLinChannel
1210
+ | AIResistanceChannel
1211
+ | AIRTDChannel
1212
+ | AIStrainGaugeChannel
1213
+ | AITempBuiltinChannel
1214
+ | AIThermocoupleChannel
1215
+ | AITorqueBridgeTableChannel
1216
+ | AITorqueBridgeTwoPointLinChannel
1217
+ | AIVelocityIEPEChannel
1218
+ | AIAccel4WireDCVoltageChannel
1219
+ | AIAccelChargeChannel
1220
+ | AIChargeChannel
1221
+ | AICurrentRMSChannel
1222
+ | AIForceBridgePolynomialChannel
1223
+ | AIFreqVoltageChannel
1224
+ | AIPressureBridgePolynomialChannel
1225
+ | AIThermistorIexChannel
1226
+ | AIThermistorVexChannel
1227
+ | AITorqueBridgePolynomialChannel
1228
+ | AIVoltageRMSChannel
1229
+ | AIVoltageWithExcitChannel;
1230
+
1231
+ export const AI_CHANNEL_SCHEMAS: {
1232
+ [K in AIChannelType]: z.ZodType<Extract<AIChannel, { type: K }>>;
1233
+ } = {
1234
+ ai_voltage: aiVoltageChannelZ,
1235
+ ai_accel: aiAccelChannelZ,
1236
+ ai_bridge: aiBridgeChannelZ,
1237
+ ai_current: aiCurrentChannelZ,
1238
+ ai_force_bridge_table: aiForceBridgeTableChannelZ,
1239
+ ai_force_bridge_two_point_lin: aiForceBridgeTwoPointLinChannelZ,
1240
+ ai_force_iepe: aiForceIEPEChannelZ,
1241
+ ai_microphone: aiMicrophoneChannelZ,
1242
+ ai_pressure_bridge_table: aiPressureBridgeTableChannelZ,
1243
+ ai_pressure_bridge_two_point_lin: aiPressureBridgeTwoPointLinChannelZ,
1244
+ ai_resistance: aiResistanceChannelZ,
1245
+ ai_rtd: aiRTDChannelZ,
1246
+ ai_strain_gauge: aiStrainGaugeChannelZ,
1247
+ ai_temp_builtin: aiTempBuiltinChannelZ,
1248
+ ai_thermocouple: aiThermocoupleChannelZ,
1249
+ ai_torque_bridge_table: aiTorqueBridgeTableChannelZ,
1250
+ ai_torque_bridge_two_point_lin: aiTorqueBridgeTwoPointLinChannelZ,
1251
+ ai_velocity_iepe: aiVelocityIEPEChannelZ,
1252
+ ai_accel_4_wire_dc_voltage: aiAccel4WireDCVoltageChannelZ,
1253
+ ai_accel_charge: aiAccelChargeChannelZ,
1254
+ ai_charge: aiChargeChannelZ,
1255
+ ai_current_rms: aiCurrentRMSChannelZ,
1256
+ ai_force_bridge_polynomial: aiForceBridgePolynomialChannelZ,
1257
+ ai_freq_voltage: aiFreqVoltageChannelZ,
1258
+ ai_pressure_bridge_polynomial: aiPressureBridgePolynomialChannelZ,
1259
+ ai_thermistor_iex: aiThermistorIexChannelZ,
1260
+ ai_thermistor_vex: aiThermistorVexChannelZ,
1261
+ ai_torque_bridge_polynomial: aiTorqueBridgePolynomialChannelZ,
1262
+ ai_voltage_rms: aiVoltageRMSChannelZ,
1263
+ ai_voltage_with_excit: aiVoltageWithExcitChannelZ,
1264
+ };
1265
+
1266
+ /** CIFrequencyChannel measures signal frequency. */
1267
+ export const ciFrequencyChannelZ = baseCIChannelZ
1268
+ .extend(customScaleZ.shape)
1269
+ .extend(minMaxValZ.shape)
1270
+ .extend({
1271
+ type: z.literal("ci_frequency"),
1272
+ /** minVal is the minimum expected frequency. */
1273
+ minVal: z.number().default(2),
1274
+ /** maxVal is the maximum expected frequency. */
1275
+ maxVal: z.number().default(100),
1276
+ /** units are the units of the frequency measurement. */
1277
+ units: ciFreqUnitsZ.default("Hz"),
1278
+ /** edge selects the edge the counter responds to. */
1279
+ edge: ciEdgeZ.default("Rising"),
1280
+ /** measMethod selects the measurement method. */
1281
+ measMethod: ciMeasMethodZ.default("DynamicAvg"),
1282
+ /** measTime is the averaging window for high-frequency measurement, in seconds. */
1283
+ measTime: z.number().default(0.000006),
1284
+ /** divisor is the counter divisor for large-range measurement. */
1285
+ divisor: z.int32().default(4),
1286
+ /** terminal is the terminal the counter signal is wired to. */
1287
+ terminal: z.string().default(""),
1288
+ });
1289
+ export interface CIFrequencyChannel extends z.infer<typeof ciFrequencyChannelZ> {}
1290
+
1291
+ /** CIEdgeCountChannel counts signal edges. */
1292
+ export const ciEdgeCountChannelZ = baseCIChannelZ.extend({
1293
+ type: z.literal("ci_edge_count"),
1294
+ /** activeEdge selects the edge that increments the count. */
1295
+ activeEdge: ciEdgeZ.default("Rising"),
1296
+ /** countDirection selects the direction the counter counts. */
1297
+ countDirection: ciCountDirectionZ.default("CountUp"),
1298
+ /** initialCount is the value the counter starts at. */
1299
+ initialCount: z.number().default(0),
1300
+ /** terminal is the terminal the counter signal is wired to. */
1301
+ terminal: z.string().default(""),
1302
+ });
1303
+ export interface CIEdgeCountChannel extends z.infer<typeof ciEdgeCountChannelZ> {}
1304
+
1305
+ /** CIPeriodChannel measures signal period. */
1306
+ export const ciPeriodChannelZ = baseCIChannelZ
1307
+ .extend(customScaleZ.shape)
1308
+ .extend(minMaxValZ.shape)
1309
+ .extend({
1310
+ type: z.literal("ci_period"),
1311
+ /** minVal is the minimum expected period, in the selected units. */
1312
+ minVal: z.number().default(0.000001),
1313
+ /** maxVal is the maximum expected period, in the selected units. */
1314
+ maxVal: z.number().default(0.1),
1315
+ /** units are the units of the period measurement. */
1316
+ units: ciTimeUnitsZ.default("Seconds"),
1317
+ /** startingEdge selects the edge that starts a period measurement. */
1318
+ startingEdge: ciEdgeZ.default("Rising"),
1319
+ /** measMethod selects the measurement method. */
1320
+ measMethod: ciMeasMethodZ.default("DynamicAvg"),
1321
+ /** measTime is the averaging window for high-frequency measurement, in seconds. */
1322
+ measTime: z.number().default(0.001),
1323
+ /** divisor is the counter divisor for large-range measurement. */
1324
+ divisor: z.int32().default(4),
1325
+ /** terminal is the terminal the counter signal is wired to. */
1326
+ terminal: z.string().default(""),
1327
+ });
1328
+ export interface CIPeriodChannel extends z.infer<typeof ciPeriodChannelZ> {}
1329
+
1330
+ /** CIPulseWidthChannel measures pulse width. */
1331
+ export const ciPulseWidthChannelZ = baseCIChannelZ
1332
+ .extend(customScaleZ.shape)
1333
+ .extend(minMaxValZ.shape)
1334
+ .extend({
1335
+ type: z.literal("ci_pulse_width"),
1336
+ /** minVal is the minimum expected pulse width, in the selected units. */
1337
+ minVal: z.number().default(0.000001),
1338
+ /** maxVal is the maximum expected pulse width, in the selected units. */
1339
+ maxVal: z.number().default(0.1),
1340
+ /** units are the units of the pulse-width measurement. */
1341
+ units: ciTimeUnitsZ.default("Seconds"),
1342
+ /** startingEdge selects the edge that starts a pulse-width measurement. */
1343
+ startingEdge: ciEdgeZ.default("Rising"),
1344
+ /** terminal is the terminal the counter signal is wired to. */
1345
+ terminal: z.string().default(""),
1346
+ });
1347
+ export interface CIPulseWidthChannel extends z.infer<typeof ciPulseWidthChannelZ> {}
1348
+
1349
+ /** CISemiPeriodChannel measures semi-period. */
1350
+ export const ciSemiPeriodChannelZ = baseCIChannelZ
1351
+ .extend(customScaleZ.shape)
1352
+ .extend(minMaxValZ.shape)
1353
+ .extend({
1354
+ type: z.literal("ci_semi_period"),
1355
+ /** minVal is the minimum expected semi-period, in the selected units. */
1356
+ minVal: z.number().default(0.000001),
1357
+ /** maxVal is the maximum expected semi-period, in the selected units. */
1358
+ maxVal: z.number().default(0.1),
1359
+ /** units are the units of the semi-period measurement. */
1360
+ units: ciTimeUnitsZ.default("Seconds"),
1361
+ /** terminal is the terminal the counter signal is wired to. */
1362
+ terminal: z.string().default(""),
1363
+ });
1364
+ export interface CISemiPeriodChannel extends z.infer<typeof ciSemiPeriodChannelZ> {}
1365
+
1366
+ /** CITwoEdgeSepChannel measures the separation between two edges. */
1367
+ export const ciTwoEdgeSepChannelZ = baseCIChannelZ
1368
+ .extend(customScaleZ.shape)
1369
+ .extend(minMaxValZ.shape)
1370
+ .extend({
1371
+ type: z.literal("ci_two_edge_sep"),
1372
+ /** minVal is the minimum expected separation, in the selected units. */
1373
+ minVal: z.number().default(0.000001),
1374
+ /** maxVal is the maximum expected separation, in the selected units. */
1375
+ maxVal: z.number().default(1),
1376
+ /** units are the units of the two-edge-separation measurement. */
1377
+ units: ciTimeUnitsZ.default("Seconds"),
1378
+ /** firstEdge selects the edge that starts the measurement. */
1379
+ firstEdge: ciEdgeZ.default("Rising"),
1380
+ /** secondEdge selects the edge that stops the measurement. */
1381
+ secondEdge: ciEdgeZ.default("Falling"),
1382
+ /** firstTerminal is the terminal the first edge's signal is wired to. */
1383
+ firstTerminal: z.string().default(""),
1384
+ /** secondTerminal is the terminal the second edge's signal is wired to. */
1385
+ secondTerminal: z.string().default(""),
1386
+ });
1387
+ export interface CITwoEdgeSepChannel extends z.infer<typeof ciTwoEdgeSepChannelZ> {}
1388
+
1389
+ /** CIVelocityLinearChannel measures linear velocity from an encoder. */
1390
+ export const ciVelocityLinearChannelZ = baseCIChannelZ
1391
+ .extend(customScaleZ.shape)
1392
+ .extend(minMaxValZ.shape)
1393
+ .extend({
1394
+ type: z.literal("ci_velocity_linear"),
1395
+ /** minVal is the minimum expected velocity. */
1396
+ minVal: z.number().default(0),
1397
+ /** maxVal is the maximum expected velocity. */
1398
+ maxVal: z.number().default(1),
1399
+ /** units are the units of the velocity measurement. */
1400
+ units: ciLinearVelocityUnitsZ.default("m/s"),
1401
+ /** decodingType selects the encoder decoding type. */
1402
+ decodingType: ciDecodingTypeZ.default("X4"),
1403
+ /** distPerPulse is the linear distance per encoder pulse. */
1404
+ distPerPulse: z.number().default(0.001),
1405
+ /** terminalA is the terminal for encoder channel A. */
1406
+ terminalA: z.string().default(""),
1407
+ /** terminalB is the terminal for encoder channel B. */
1408
+ terminalB: z.string().default(""),
1409
+ });
1410
+ export interface CIVelocityLinearChannel extends z.infer<
1411
+ typeof ciVelocityLinearChannelZ
1412
+ > {}
1413
+
1414
+ /** CIVelocityAngularChannel measures angular velocity from an encoder. */
1415
+ export const ciVelocityAngularChannelZ = baseCIChannelZ
1416
+ .extend(customScaleZ.shape)
1417
+ .extend(minMaxValZ.shape)
1418
+ .extend({
1419
+ type: z.literal("ci_velocity_angular"),
1420
+ /** minVal is the minimum expected velocity. */
1421
+ minVal: z.number().default(0),
1422
+ /** maxVal is the maximum expected velocity. */
1423
+ maxVal: z.number().default(1),
1424
+ /** units are the units of the velocity measurement. */
1425
+ units: ciAngularVelocityUnitsZ.default("RPM"),
1426
+ /** decodingType selects the encoder decoding type. */
1427
+ decodingType: ciDecodingTypeZ.default("X4"),
1428
+ /** pulsesPerRev is the number of encoder pulses per revolution. */
1429
+ pulsesPerRev: z.number().default(24),
1430
+ /** terminalA is the terminal for encoder channel A. */
1431
+ terminalA: z.string().default(""),
1432
+ /** terminalB is the terminal for encoder channel B. */
1433
+ terminalB: z.string().default(""),
1434
+ });
1435
+ export interface CIVelocityAngularChannel extends z.infer<
1436
+ typeof ciVelocityAngularChannelZ
1437
+ > {}
1438
+
1439
+ /** CIPositionLinearChannel measures linear position from an encoder. */
1440
+ export const ciPositionLinearChannelZ = baseCIChannelZ
1441
+ .extend(customScaleZ.shape)
1442
+ .extend(zIndexZ.shape)
1443
+ .extend({
1444
+ type: z.literal("ci_position_linear"),
1445
+ /** units are the units of the position measurement. */
1446
+ units: ciLinearPositionUnitsZ.default("Meters"),
1447
+ /** decodingType selects the encoder decoding type. */
1448
+ decodingType: ciDecodingTypeZ.default("X4"),
1449
+ /** distPerPulse is the linear distance per encoder pulse. */
1450
+ distPerPulse: z.number().default(0.000001),
1451
+ /** initialPos is the position the encoder starts at. */
1452
+ initialPos: z.number().default(0),
1453
+ /** terminalA is the terminal for encoder channel A. */
1454
+ terminalA: z.string().default(""),
1455
+ /** terminalB is the terminal for encoder channel B. */
1456
+ terminalB: z.string().default(""),
1457
+ });
1458
+ export interface CIPositionLinearChannel extends z.infer<
1459
+ typeof ciPositionLinearChannelZ
1460
+ > {}
1461
+
1462
+ /** CIPositionAngularChannel measures angular position from an encoder. */
1463
+ export const ciPositionAngularChannelZ = baseCIChannelZ
1464
+ .extend(customScaleZ.shape)
1465
+ .extend(zIndexZ.shape)
1466
+ .extend({
1467
+ type: z.literal("ci_position_angular"),
1468
+ /** units are the units of the position measurement. */
1469
+ units: ciAngularPositionUnitsZ.default("Degrees"),
1470
+ /** decodingType selects the encoder decoding type. */
1471
+ decodingType: ciDecodingTypeZ.default("X4"),
1472
+ /** pulsesPerRev is the number of encoder pulses per revolution. */
1473
+ pulsesPerRev: z.number().default(24),
1474
+ /** initialAngle is the angle the encoder starts at. */
1475
+ initialAngle: z.number().default(0),
1476
+ /** terminalA is the terminal for encoder channel A. */
1477
+ terminalA: z.string().default(""),
1478
+ /** terminalB is the terminal for encoder channel B. */
1479
+ terminalB: z.string().default(""),
1480
+ });
1481
+ export interface CIPositionAngularChannel extends z.infer<
1482
+ typeof ciPositionAngularChannelZ
1483
+ > {}
1484
+
1485
+ /** CIDutyCycleChannel measures the duty cycle of a signal. */
1486
+ export const ciDutyCycleChannelZ = baseCIChannelZ
1487
+ .extend(customScaleZ.shape)
1488
+ .extend(minMaxValZ.shape)
1489
+ .extend({
1490
+ type: z.literal("ci_duty_cycle"),
1491
+ /** minVal is the minimum expected duty-cycle frequency. */
1492
+ minVal: z.number().default(2),
1493
+ /** maxVal is the maximum expected duty-cycle frequency. */
1494
+ maxVal: z.number().default(10000),
1495
+ /** activeEdge selects the edge the counter responds to. */
1496
+ activeEdge: ciEdgeZ.default("Rising"),
1497
+ /** terminal is the terminal the counter signal is wired to. */
1498
+ terminal: z.string().default(""),
1499
+ });
1500
+ export interface CIDutyCycleChannel extends z.infer<typeof ciDutyCycleChannelZ> {}
1501
+
1502
+ export const CI_CHANNEL_TYPES = [
1503
+ "ci_frequency",
1504
+ "ci_edge_count",
1505
+ "ci_period",
1506
+ "ci_pulse_width",
1507
+ "ci_semi_period",
1508
+ "ci_two_edge_sep",
1509
+ "ci_velocity_linear",
1510
+ "ci_velocity_angular",
1511
+ "ci_position_linear",
1512
+ "ci_position_angular",
1513
+ "ci_duty_cycle",
1514
+ ] as const;
1515
+ export const ciChannelTypeZ = z.enum(CI_CHANNEL_TYPES);
1516
+ export type CIChannelType = z.infer<typeof ciChannelTypeZ>;
1517
+
1518
+ /**
1519
+ * CIChannel is a single NI counter input channel. The type field selects the
1520
+ * measurement mode and the fields that accompany it.
1521
+ */
1522
+ export const ciChannelZ = z.discriminatedUnion("type", [
1523
+ ciFrequencyChannelZ,
1524
+ ciEdgeCountChannelZ,
1525
+ ciPeriodChannelZ,
1526
+ ciPulseWidthChannelZ,
1527
+ ciSemiPeriodChannelZ,
1528
+ ciTwoEdgeSepChannelZ,
1529
+ ciVelocityLinearChannelZ,
1530
+ ciVelocityAngularChannelZ,
1531
+ ciPositionLinearChannelZ,
1532
+ ciPositionAngularChannelZ,
1533
+ ciDutyCycleChannelZ,
1534
+ ]);
1535
+ export type CIChannel =
1536
+ | CIFrequencyChannel
1537
+ | CIEdgeCountChannel
1538
+ | CIPeriodChannel
1539
+ | CIPulseWidthChannel
1540
+ | CISemiPeriodChannel
1541
+ | CITwoEdgeSepChannel
1542
+ | CIVelocityLinearChannel
1543
+ | CIVelocityAngularChannel
1544
+ | CIPositionLinearChannel
1545
+ | CIPositionAngularChannel
1546
+ | CIDutyCycleChannel;
1547
+
1548
+ export const CI_CHANNEL_SCHEMAS: {
1549
+ [K in CIChannelType]: z.ZodType<Extract<CIChannel, { type: K }>>;
1550
+ } = {
1551
+ ci_frequency: ciFrequencyChannelZ,
1552
+ ci_edge_count: ciEdgeCountChannelZ,
1553
+ ci_period: ciPeriodChannelZ,
1554
+ ci_pulse_width: ciPulseWidthChannelZ,
1555
+ ci_semi_period: ciSemiPeriodChannelZ,
1556
+ ci_two_edge_sep: ciTwoEdgeSepChannelZ,
1557
+ ci_velocity_linear: ciVelocityLinearChannelZ,
1558
+ ci_velocity_angular: ciVelocityAngularChannelZ,
1559
+ ci_position_linear: ciPositionLinearChannelZ,
1560
+ ci_position_angular: ciPositionAngularChannelZ,
1561
+ ci_duty_cycle: ciDutyCycleChannelZ,
1562
+ };
1563
+
1564
+ /** AOCurrentChannel drives a current output. */
1565
+ export const aoCurrentChannelZ = baseAOChannelZ
1566
+ .extend(minMaxValZ.shape)
1567
+ .extend(customScaleZ.shape)
1568
+ .extend({
1569
+ type: z.literal("ao_current"),
1570
+ });
1571
+ export interface AOCurrentChannel extends z.infer<typeof aoCurrentChannelZ> {}
1572
+
1573
+ /** AOFuncGenChannel drives a function-generator output. */
1574
+ export const aoFuncGenChannelZ = baseAOChannelZ.extend({
1575
+ type: z.literal("ao_func_gen"),
1576
+ /** waveType selects the waveform to generate. */
1577
+ waveType: waveTypeZ.default("Sine"),
1578
+ /** frequency is the waveform frequency, in Hertz. */
1579
+ frequency: z.number().default(0),
1580
+ /** amplitude is the waveform amplitude. */
1581
+ amplitude: z.number().default(0),
1582
+ /** offset is the waveform DC offset. */
1583
+ offset: z.number().default(0),
1584
+ });
1585
+ export interface AOFuncGenChannel extends z.infer<typeof aoFuncGenChannelZ> {}
1586
+
1587
+ /** AOVoltageChannel drives a voltage output. */
1588
+ export const aoVoltageChannelZ = baseAOChannelZ
1589
+ .extend(minMaxValZ.shape)
1590
+ .extend(customScaleZ.shape)
1591
+ .extend({
1592
+ type: z.literal("ao_voltage"),
1593
+ });
1594
+ export interface AOVoltageChannel extends z.infer<typeof aoVoltageChannelZ> {}
1595
+
1596
+ export const AO_CHANNEL_TYPES = ["ao_current", "ao_func_gen", "ao_voltage"] as const;
1597
+ export const aoChannelTypeZ = z.enum(AO_CHANNEL_TYPES);
1598
+ export type AOChannelType = z.infer<typeof aoChannelTypeZ>;
1599
+
1600
+ /**
1601
+ * AOChannel is a single NI analog output channel. The type field selects the output
1602
+ * mode and the fields that accompany it.
1603
+ */
1604
+ export const aoChannelZ = z.discriminatedUnion("type", [
1605
+ aoCurrentChannelZ,
1606
+ aoFuncGenChannelZ,
1607
+ aoVoltageChannelZ,
1608
+ ]);
1609
+ export type AOChannel = AOCurrentChannel | AOFuncGenChannel | AOVoltageChannel;
1610
+
1611
+ export const AO_CHANNEL_SCHEMAS: {
1612
+ [K in AOChannelType]: z.ZodType<Extract<AOChannel, { type: K }>>;
1613
+ } = {
1614
+ ao_current: aoCurrentChannelZ,
1615
+ ao_func_gen: aoFuncGenChannelZ,
1616
+ ao_voltage: aoVoltageChannelZ,
1617
+ };
1618
+
1619
+ export const analogReadConfigZ = task.readConfigZ.extend({
1620
+ channels: aiChannelZ.array().default(() => []),
1621
+ });
1622
+ export interface AnalogReadConfig extends z.infer<typeof analogReadConfigZ> {}
1623
+
1624
+ export const counterReadConfigZ = task.readConfigZ.extend({
1625
+ channels: ciChannelZ.array().default(() => []),
1626
+ });
1627
+ export interface CounterReadConfig extends z.infer<typeof counterReadConfigZ> {}
1628
+
1629
+ export const analogWriteConfigZ = writeConfigZ.extend({
1630
+ channels: aoChannelZ.array().default(() => []),
1631
+ });
1632
+ export interface AnalogWriteConfig extends z.infer<typeof analogWriteConfigZ> {}