@fnndsc/brasa 0.57.4 → 0.58.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 (512) hide show
  1. package/dist/api/models.d.ts +2 -3
  2. package/dist/api/models.js.map +1 -1
  3. package/dist/buildinfo.json +1 -1
  4. package/dist/builtins/argumentTokens.js +25 -6
  5. package/dist/builtins/argumentTokens.js.map +1 -1
  6. package/dist/builtins/berth/berth.d.ts +0 -14
  7. package/dist/builtins/berth/berth.js +255 -88
  8. package/dist/builtins/berth/berth.js.map +1 -1
  9. package/dist/builtins/berth/berthClose.d.ts +66 -1
  10. package/dist/builtins/berth/berthClose.js +312 -26
  11. package/dist/builtins/berth/berthClose.js.map +1 -1
  12. package/dist/builtins/berth/berthClosed.d.ts +212 -0
  13. package/dist/builtins/berth/berthClosed.js +231 -0
  14. package/dist/builtins/berth/berthClosed.js.map +1 -0
  15. package/dist/builtins/berth/berthCube.js +27 -6
  16. package/dist/builtins/berth/berthCube.js.map +1 -1
  17. package/dist/builtins/berth/berthDisk.js +1 -1
  18. package/dist/builtins/berth/berthDisk.js.map +1 -1
  19. package/dist/builtins/berth/berthProcesses.js +15 -3
  20. package/dist/builtins/berth/berthProcesses.js.map +1 -1
  21. package/dist/builtins/berth/berthRecord.d.ts +14 -2
  22. package/dist/builtins/berth/berthRecord.js +20 -5
  23. package/dist/builtins/berth/berthRecord.js.map +1 -1
  24. package/dist/builtins/berth/berthState.d.ts +26 -6
  25. package/dist/builtins/berth/berthState.js +47 -13
  26. package/dist/builtins/berth/berthState.js.map +1 -1
  27. package/dist/builtins/debug.d.ts +0 -8
  28. package/dist/builtins/debug.js +1 -12
  29. package/dist/builtins/debug.js.map +1 -1
  30. package/dist/builtins/executable.js +102 -75
  31. package/dist/builtins/executable.js.map +1 -1
  32. package/dist/builtins/feedTotals.js +30 -25
  33. package/dist/builtins/feedTotals.js.map +1 -1
  34. package/dist/builtins/fs/acl.args.d.ts +3 -10
  35. package/dist/builtins/fs/acl.args.js +16 -24
  36. package/dist/builtins/fs/acl.args.js.map +1 -1
  37. package/dist/builtins/fs/acl.d.ts +0 -37
  38. package/dist/builtins/fs/acl.js +36 -58
  39. package/dist/builtins/fs/acl.js.map +1 -1
  40. package/dist/builtins/fs/archive.js +4 -7
  41. package/dist/builtins/fs/archive.js.map +1 -1
  42. package/dist/builtins/fs/cat.d.ts +0 -16
  43. package/dist/builtins/fs/cat.js +163 -96
  44. package/dist/builtins/fs/cat.js.map +1 -1
  45. package/dist/builtins/fs/cd.js +23 -5
  46. package/dist/builtins/fs/cd.js.map +1 -1
  47. package/dist/builtins/fs/configWrite.d.ts +0 -8
  48. package/dist/builtins/fs/configWrite.js +33 -46
  49. package/dist/builtins/fs/configWrite.js.map +1 -1
  50. package/dist/builtins/fs/cp.d.ts +6 -10
  51. package/dist/builtins/fs/cp.js +83 -86
  52. package/dist/builtins/fs/cp.js.map +1 -1
  53. package/dist/builtins/fs/deliveryIntent.d.ts +24 -0
  54. package/dist/builtins/fs/deliveryIntent.js +182 -0
  55. package/dist/builtins/fs/deliveryIntent.js.map +1 -0
  56. package/dist/builtins/fs/deliveryMatch.d.ts +138 -0
  57. package/dist/builtins/fs/deliveryMatch.js +135 -0
  58. package/dist/builtins/fs/deliveryMatch.js.map +1 -0
  59. package/dist/builtins/fs/destination.d.ts +37 -1
  60. package/dist/builtins/fs/destination.js +80 -0
  61. package/dist/builtins/fs/destination.js.map +1 -1
  62. package/dist/builtins/fs/download.d.ts +19 -8
  63. package/dist/builtins/fs/download.js +142 -72
  64. package/dist/builtins/fs/download.js.map +1 -1
  65. package/dist/builtins/fs/du.d.ts +0 -8
  66. package/dist/builtins/fs/du.js +23 -20
  67. package/dist/builtins/fs/du.js.map +1 -1
  68. package/dist/builtins/fs/edit.js +117 -50
  69. package/dist/builtins/fs/edit.js.map +1 -1
  70. package/dist/builtins/fs/entries.d.ts +38 -0
  71. package/dist/builtins/fs/entries.js +48 -1
  72. package/dist/builtins/fs/entries.js.map +1 -1
  73. package/dist/builtins/fs/find.d.ts +1 -1
  74. package/dist/builtins/fs/find.js +462 -271
  75. package/dist/builtins/fs/find.js.map +1 -1
  76. package/dist/builtins/fs/ls.d.ts +2 -8
  77. package/dist/builtins/fs/ls.js +144 -93
  78. package/dist/builtins/fs/ls.js.map +1 -1
  79. package/dist/builtins/fs/mkdir.d.ts +2 -7
  80. package/dist/builtins/fs/mkdir.js +110 -58
  81. package/dist/builtins/fs/mkdir.js.map +1 -1
  82. package/dist/builtins/fs/mv.d.ts +7 -10
  83. package/dist/builtins/fs/mv.js +155 -100
  84. package/dist/builtins/fs/mv.js.map +1 -1
  85. package/dist/builtins/fs/pull.js +155 -92
  86. package/dist/builtins/fs/pull.js.map +1 -1
  87. package/dist/builtins/fs/pwd.d.ts +0 -7
  88. package/dist/builtins/fs/pwd.js +0 -12
  89. package/dist/builtins/fs/pwd.js.map +1 -1
  90. package/dist/builtins/fs/rm.d.ts +6 -7
  91. package/dist/builtins/fs/rm.js +364 -174
  92. package/dist/builtins/fs/rm.js.map +1 -1
  93. package/dist/builtins/fs/rmdir.d.ts +0 -7
  94. package/dist/builtins/fs/rmdir.js +40 -21
  95. package/dist/builtins/fs/rmdir.js.map +1 -1
  96. package/dist/builtins/fs/touch.d.ts +0 -7
  97. package/dist/builtins/fs/touch.js +14 -27
  98. package/dist/builtins/fs/touch.js.map +1 -1
  99. package/dist/builtins/fs/transferJobs.d.ts +12 -0
  100. package/dist/builtins/fs/transferJobs.js +19 -0
  101. package/dist/builtins/fs/transferJobs.js.map +1 -1
  102. package/dist/builtins/fs/tree.d.ts +0 -8
  103. package/dist/builtins/fs/tree.js +1 -12
  104. package/dist/builtins/fs/tree.js.map +1 -1
  105. package/dist/builtins/fs/upload.d.ts +0 -8
  106. package/dist/builtins/fs/upload.js +23 -20
  107. package/dist/builtins/fs/upload.js.map +1 -1
  108. package/dist/builtins/fs/url.d.ts +14 -2
  109. package/dist/builtins/fs/url.js +6 -8
  110. package/dist/builtins/fs/url.js.map +1 -1
  111. package/dist/builtins/fs/writeReport.d.ts +40 -0
  112. package/dist/builtins/fs/writeReport.js +71 -0
  113. package/dist/builtins/fs/writeReport.js.map +1 -0
  114. package/dist/builtins/fs/xattr.args.d.ts +14 -13
  115. package/dist/builtins/fs/xattr.args.js +3 -24
  116. package/dist/builtins/fs/xattr.args.js.map +1 -1
  117. package/dist/builtins/fs/xattr.d.ts +0 -25
  118. package/dist/builtins/fs/xattr.js +82 -65
  119. package/dist/builtins/fs/xattr.js.map +1 -1
  120. package/dist/builtins/games/bytes.d.ts +0 -55
  121. package/dist/builtins/games/bytes.js +95 -120
  122. package/dist/builtins/games/bytes.js.map +1 -1
  123. package/dist/builtins/games/chimes.d.ts +0 -36
  124. package/dist/builtins/games/chimes.js +58 -64
  125. package/dist/builtins/games/chimes.js.map +1 -1
  126. package/dist/builtins/games/chrislab.d.ts +0 -12
  127. package/dist/builtins/games/chrislab.js +0 -14
  128. package/dist/builtins/games/chrislab.js.map +1 -1
  129. package/dist/builtins/games/cowsay.d.ts +0 -24
  130. package/dist/builtins/games/cowsay.js +0 -29
  131. package/dist/builtins/games/cowsay.js.map +1 -1
  132. package/dist/builtins/games/figlet.d.ts +0 -24
  133. package/dist/builtins/games/figlet.js +0 -29
  134. package/dist/builtins/games/figlet.js.map +1 -1
  135. package/dist/builtins/games/lab.d.ts +0 -36
  136. package/dist/builtins/games/lab.js +0 -43
  137. package/dist/builtins/games/lab.js.map +1 -1
  138. package/dist/builtins/games/lolcat.d.ts +0 -12
  139. package/dist/builtins/games/lolcat.js +2 -17
  140. package/dist/builtins/games/lolcat.js.map +1 -1
  141. package/dist/builtins/games/numbers.d.ts +0 -60
  142. package/dist/builtins/games/numbers.js +0 -71
  143. package/dist/builtins/games/numbers.js.map +1 -1
  144. package/dist/builtins/games/play.d.ts +0 -36
  145. package/dist/builtins/games/play.js +47 -58
  146. package/dist/builtins/games/play.js.map +1 -1
  147. package/dist/builtins/games/qr.d.ts +0 -12
  148. package/dist/builtins/games/qr.js +189 -68
  149. package/dist/builtins/games/qr.js.map +1 -1
  150. package/dist/builtins/games/show.d.ts +0 -73
  151. package/dist/builtins/games/show.js +0 -85
  152. package/dist/builtins/games/show.js.map +1 -1
  153. package/dist/builtins/games/sky.d.ts +0 -36
  154. package/dist/builtins/games/sky.js +25 -45
  155. package/dist/builtins/games/sky.js.map +1 -1
  156. package/dist/builtins/games/text.d.ts +0 -72
  157. package/dist/builtins/games/text.js +0 -85
  158. package/dist/builtins/games/text.js.map +1 -1
  159. package/dist/builtins/games/trek.d.ts +0 -12
  160. package/dist/builtins/games/trek.js +0 -15
  161. package/dist/builtins/games/trek.js.map +1 -1
  162. package/dist/builtins/games/wtf.d.ts +0 -12
  163. package/dist/builtins/games/wtf.js +0 -15
  164. package/dist/builtins/games/wtf.js.map +1 -1
  165. package/dist/builtins/help.d.ts +0 -19
  166. package/dist/builtins/help.js +56 -39
  167. package/dist/builtins/help.js.map +1 -1
  168. package/dist/builtins/helpSections.js +13 -1
  169. package/dist/builtins/helpSections.js.map +1 -1
  170. package/dist/builtins/index.d.ts +1 -1
  171. package/dist/builtins/index.js +1 -1
  172. package/dist/builtins/index.js.map +1 -1
  173. package/dist/builtins/net/connect.d.ts +1 -8
  174. package/dist/builtins/net/connect.js +2 -13
  175. package/dist/builtins/net/connect.js.map +1 -1
  176. package/dist/builtins/net/cubepath.js +30 -20
  177. package/dist/builtins/net/cubepath.js.map +1 -1
  178. package/dist/builtins/net/logout.d.ts +0 -8
  179. package/dist/builtins/net/logout.js +1 -12
  180. package/dist/builtins/net/logout.js.map +1 -1
  181. package/dist/builtins/net/netstat.d.ts +0 -8
  182. package/dist/builtins/net/netstat.js +1 -12
  183. package/dist/builtins/net/netstat.js.map +1 -1
  184. package/dist/builtins/net/pacs.d.ts +3 -17
  185. package/dist/builtins/net/pacs.js +50 -42
  186. package/dist/builtins/net/pacs.js.map +1 -1
  187. package/dist/builtins/net/pacsUtils.d.ts +0 -2
  188. package/dist/builtins/net/pacsUtils.js +67 -30
  189. package/dist/builtins/net/pacsUtils.js.map +1 -1
  190. package/dist/builtins/net/query.anon.d.ts +61 -0
  191. package/dist/builtins/net/query.anon.js +362 -0
  192. package/dist/builtins/net/query.anon.js.map +1 -0
  193. package/dist/builtins/net/query.args.d.ts +2 -1
  194. package/dist/builtins/net/query.args.js +1 -1
  195. package/dist/builtins/net/query.args.js.map +1 -1
  196. package/dist/builtins/net/query.cohort.d.ts +125 -0
  197. package/dist/builtins/net/query.cohort.js +267 -0
  198. package/dist/builtins/net/query.cohort.js.map +1 -0
  199. package/dist/builtins/net/query.csv.d.ts +26 -5
  200. package/dist/builtins/net/query.csv.js +61 -115
  201. package/dist/builtins/net/query.csv.js.map +1 -1
  202. package/dist/builtins/net/query.d.ts +27 -34
  203. package/dist/builtins/net/query.deliver.d.ts +96 -0
  204. package/dist/builtins/net/query.deliver.js +188 -0
  205. package/dist/builtins/net/query.deliver.js.map +1 -0
  206. package/dist/builtins/net/query.fanout.d.ts +32 -0
  207. package/dist/builtins/net/query.fanout.js +91 -0
  208. package/dist/builtins/net/query.fanout.js.map +1 -1
  209. package/dist/builtins/net/query.held.d.ts +60 -0
  210. package/dist/builtins/net/query.held.js +125 -0
  211. package/dist/builtins/net/query.held.js.map +1 -0
  212. package/dist/builtins/net/query.ignored.d.ts +3 -1
  213. package/dist/builtins/net/query.ignored.js +9 -3
  214. package/dist/builtins/net/query.ignored.js.map +1 -1
  215. package/dist/builtins/net/query.js +360 -634
  216. package/dist/builtins/net/query.js.map +1 -1
  217. package/dist/builtins/net/query.model.d.ts +15 -0
  218. package/dist/builtins/net/query.model.js +109 -46
  219. package/dist/builtins/net/query.model.js.map +1 -1
  220. package/dist/builtins/net/query.view.js +29 -8
  221. package/dist/builtins/net/query.view.js.map +1 -1
  222. package/dist/builtins/operandRuns.js +4 -3
  223. package/dist/builtins/operandRuns.js.map +1 -1
  224. package/dist/builtins/operands.js +97 -39
  225. package/dist/builtins/operands.js.map +1 -1
  226. package/dist/builtins/pluginExecute.js +311 -205
  227. package/dist/builtins/pluginExecute.js.map +1 -1
  228. package/dist/builtins/proc.d.ts +1 -13
  229. package/dist/builtins/proc.helpers.d.ts +0 -7
  230. package/dist/builtins/proc.helpers.js +0 -10
  231. package/dist/builtins/proc.helpers.js.map +1 -1
  232. package/dist/builtins/proc.js +159 -116
  233. package/dist/builtins/proc.js.map +1 -1
  234. package/dist/builtins/procWatch.d.ts +2 -2
  235. package/dist/builtins/procWatch.js +54 -13
  236. package/dist/builtins/procWatch.js.map +1 -1
  237. package/dist/builtins/res/compute.d.ts +0 -13
  238. package/dist/builtins/res/compute.js +0 -16
  239. package/dist/builtins/res/compute.js.map +1 -1
  240. package/dist/builtins/res/diagram.tree.js +36 -12
  241. package/dist/builtins/res/diagram.tree.js.map +1 -1
  242. package/dist/builtins/res/dicom.d.ts +24 -17
  243. package/dist/builtins/res/dicom.js +78 -79
  244. package/dist/builtins/res/dicom.js.map +1 -1
  245. package/dist/builtins/res/expect.d.ts +8 -17
  246. package/dist/builtins/res/expect.js +173 -101
  247. package/dist/builtins/res/expect.js.map +1 -1
  248. package/dist/builtins/res/feed.d.ts +0 -13
  249. package/dist/builtins/res/feed.diagram.js +89 -57
  250. package/dist/builtins/res/feed.diagram.js.map +1 -1
  251. package/dist/builtins/res/feed.js +61 -42
  252. package/dist/builtins/res/feed.js.map +1 -1
  253. package/dist/builtins/res/feed.tree.collapse.d.ts +0 -10
  254. package/dist/builtins/res/feed.tree.collapse.js +12 -5
  255. package/dist/builtins/res/feed.tree.collapse.js.map +1 -1
  256. package/dist/builtins/res/files.d.ts +0 -37
  257. package/dist/builtins/res/files.js +0 -44
  258. package/dist/builtins/res/files.js.map +1 -1
  259. package/dist/builtins/res/gather.d.ts +0 -13
  260. package/dist/builtins/res/gather.facts.js +24 -16
  261. package/dist/builtins/res/gather.facts.js.map +1 -1
  262. package/dist/builtins/res/gather.js +47 -36
  263. package/dist/builtins/res/gather.js.map +1 -1
  264. package/dist/builtins/res/gather.process.js +49 -15
  265. package/dist/builtins/res/gather.process.js.map +1 -1
  266. package/dist/builtins/res/gather.store.d.ts +4 -2
  267. package/dist/builtins/res/gather.store.js +43 -31
  268. package/dist/builtins/res/gather.store.js.map +1 -1
  269. package/dist/builtins/res/group.d.ts +0 -13
  270. package/dist/builtins/res/group.js +78 -40
  271. package/dist/builtins/res/group.js.map +1 -1
  272. package/dist/builtins/res/image.d.ts +0 -13
  273. package/dist/builtins/res/image.js +0 -15
  274. package/dist/builtins/res/image.js.map +1 -1
  275. package/dist/builtins/res/manifestRead.d.ts +65 -0
  276. package/dist/builtins/res/manifestRead.js +161 -0
  277. package/dist/builtins/res/manifestRead.js.map +1 -0
  278. package/dist/builtins/res/pipeline.d.ts +1 -1
  279. package/dist/builtins/res/pipeline.js +152 -103
  280. package/dist/builtins/res/pipeline.js.map +1 -1
  281. package/dist/builtins/res/pipeline.manifest.js +17 -7
  282. package/dist/builtins/res/pipeline.manifest.js.map +1 -1
  283. package/dist/builtins/res/play.d.ts +0 -13
  284. package/dist/builtins/res/play.js +367 -226
  285. package/dist/builtins/res/play.js.map +1 -1
  286. package/dist/builtins/res/plugin.d.ts +1 -13
  287. package/dist/builtins/res/plugin.info.js +36 -14
  288. package/dist/builtins/res/plugin.info.js.map +1 -1
  289. package/dist/builtins/res/plugin.js +1 -17
  290. package/dist/builtins/res/plugin.js.map +1 -1
  291. package/dist/builtins/res/plugin.sync.d.ts +3 -5
  292. package/dist/builtins/res/plugin.sync.js +175 -40
  293. package/dist/builtins/res/plugin.sync.js.map +1 -1
  294. package/dist/builtins/res/plugininstance.d.ts +0 -13
  295. package/dist/builtins/res/plugininstance.js +0 -16
  296. package/dist/builtins/res/plugininstance.js.map +1 -1
  297. package/dist/builtins/res/pluginmeta.d.ts +0 -13
  298. package/dist/builtins/res/pluginmeta.js +0 -16
  299. package/dist/builtins/res/pluginmeta.js.map +1 -1
  300. package/dist/builtins/res/record.d.ts +0 -13
  301. package/dist/builtins/res/record.js +2 -18
  302. package/dist/builtins/res/record.js.map +1 -1
  303. package/dist/builtins/res/runWait.js +32 -8
  304. package/dist/builtins/res/runWait.js.map +1 -1
  305. package/dist/builtins/res/tag.d.ts +0 -13
  306. package/dist/builtins/res/tag.js +0 -16
  307. package/dist/builtins/res/tag.js.map +1 -1
  308. package/dist/builtins/res/thumbnail.js +23 -8
  309. package/dist/builtins/res/thumbnail.js.map +1 -1
  310. package/dist/builtins/res/user.d.ts +0 -12
  311. package/dist/builtins/res/user.js +0 -17
  312. package/dist/builtins/res/user.js.map +1 -1
  313. package/dist/builtins/res/workflow.d.ts +0 -13
  314. package/dist/builtins/res/workflow.js +0 -16
  315. package/dist/builtins/res/workflow.js.map +1 -1
  316. package/dist/builtins/runEcho.js +2 -1
  317. package/dist/builtins/runEcho.js.map +1 -1
  318. package/dist/builtins/store.d.ts +0 -13
  319. package/dist/builtins/store.js +32 -32
  320. package/dist/builtins/store.js.map +1 -1
  321. package/dist/builtins/sys/apropos.d.ts +2 -27
  322. package/dist/builtins/sys/apropos.js +2 -32
  323. package/dist/builtins/sys/apropos.js.map +1 -1
  324. package/dist/builtins/sys/cal.d.ts +0 -12
  325. package/dist/builtins/sys/cal.js +0 -15
  326. package/dist/builtins/sys/cal.js.map +1 -1
  327. package/dist/builtins/sys/command.js +3 -7
  328. package/dist/builtins/sys/command.js.map +1 -1
  329. package/dist/builtins/sys/context.d.ts +0 -8
  330. package/dist/builtins/sys/context.js +1 -12
  331. package/dist/builtins/sys/context.js.map +1 -1
  332. package/dist/builtins/sys/date.d.ts +0 -12
  333. package/dist/builtins/sys/date.js +0 -15
  334. package/dist/builtins/sys/date.js.map +1 -1
  335. package/dist/builtins/sys/echo.d.ts +0 -12
  336. package/dist/builtins/sys/echo.js +54 -49
  337. package/dist/builtins/sys/echo.js.map +1 -1
  338. package/dist/builtins/sys/fortune.d.ts +0 -12
  339. package/dist/builtins/sys/fortune.js +0 -15
  340. package/dist/builtins/sys/fortune.js.map +1 -1
  341. package/dist/builtins/sys/grep.d.ts +14 -18
  342. package/dist/builtins/sys/grep.js +239 -114
  343. package/dist/builtins/sys/grep.js.map +1 -1
  344. package/dist/builtins/sys/hostGrants.d.ts +85 -0
  345. package/dist/builtins/sys/hostGrants.js +207 -0
  346. package/dist/builtins/sys/hostGrants.js.map +1 -0
  347. package/dist/builtins/sys/joblets.d.ts +0 -24
  348. package/dist/builtins/sys/joblets.js +0 -29
  349. package/dist/builtins/sys/joblets.js.map +1 -1
  350. package/dist/builtins/sys/motd.d.ts +0 -12
  351. package/dist/builtins/sys/motd.js +14 -21
  352. package/dist/builtins/sys/motd.js.map +1 -1
  353. package/dist/builtins/sys/notes.js +26 -16
  354. package/dist/builtins/sys/notes.js.map +1 -1
  355. package/dist/builtins/sys/physicalmode.d.ts +0 -8
  356. package/dist/builtins/sys/physicalmode.js +1 -12
  357. package/dist/builtins/sys/physicalmode.js.map +1 -1
  358. package/dist/builtins/sys/tasks.d.ts +0 -24
  359. package/dist/builtins/sys/tasks.js +30 -36
  360. package/dist/builtins/sys/tasks.js.map +1 -1
  361. package/dist/builtins/sys/textFilters.d.ts +0 -84
  362. package/dist/builtins/sys/textFilters.js +33 -110
  363. package/dist/builtins/sys/textFilters.js.map +1 -1
  364. package/dist/builtins/sys/timing.d.ts +0 -8
  365. package/dist/builtins/sys/timing.js +1 -12
  366. package/dist/builtins/sys/timing.js.map +1 -1
  367. package/dist/builtins/sys/variables.d.ts +0 -24
  368. package/dist/builtins/sys/variables.js +0 -29
  369. package/dist/builtins/sys/variables.js.map +1 -1
  370. package/dist/builtins/sys/version.d.ts +0 -12
  371. package/dist/builtins/sys/version.js +0 -15
  372. package/dist/builtins/sys/version.js.map +1 -1
  373. package/dist/builtins/sys/weather.js +46 -27
  374. package/dist/builtins/sys/weather.js.map +1 -1
  375. package/dist/builtins/sys/whoami.d.ts +0 -22
  376. package/dist/builtins/sys/whoami.js +16 -43
  377. package/dist/builtins/sys/whoami.js.map +1 -1
  378. package/dist/builtins/utils.d.ts +4 -39
  379. package/dist/builtins/utils.js +24 -55
  380. package/dist/builtins/utils.js.map +1 -1
  381. package/dist/chris/backend.js +7 -12
  382. package/dist/chris/backend.js.map +1 -1
  383. package/dist/chris/binDeclarations.d.ts +0 -44
  384. package/dist/chris/binDeclarations.js +111 -29
  385. package/dist/chris/binDeclarations.js.map +1 -1
  386. package/dist/chris/binExecutables.js +26 -18
  387. package/dist/chris/binExecutables.js.map +1 -1
  388. package/dist/chris/chiliDelegate.d.ts +104 -0
  389. package/dist/chris/chiliDelegate.js +240 -0
  390. package/dist/chris/chiliDelegate.js.map +1 -1
  391. package/dist/chris/commandFallback.d.ts +2 -2
  392. package/dist/chris/commandFallback.js +107 -50
  393. package/dist/chris/commandFallback.js.map +1 -1
  394. package/dist/chris/completion.d.ts +3 -1
  395. package/dist/chris/completion.js +5 -17
  396. package/dist/chris/completion.js.map +1 -1
  397. package/dist/chris/connect.d.ts +37 -0
  398. package/dist/chris/connect.js +46 -0
  399. package/dist/chris/connect.js.map +1 -1
  400. package/dist/chris/files.js +32 -2
  401. package/dist/chris/files.js.map +1 -1
  402. package/dist/chris/navigation.js +87 -53
  403. package/dist/chris/navigation.js.map +1 -1
  404. package/dist/chris/pacsResources.js +28 -11
  405. package/dist/chris/pacsResources.js.map +1 -1
  406. package/dist/chris/promptContext.js +68 -35
  407. package/dist/chris/promptContext.js.map +1 -1
  408. package/dist/chris/universeLayout.d.ts +8 -2
  409. package/dist/chris/universeLayout.js +40 -11
  410. package/dist/chris/universeLayout.js.map +1 -1
  411. package/dist/chris/warmup.d.ts +140 -0
  412. package/dist/chris/warmup.js +622 -0
  413. package/dist/chris/warmup.js.map +1 -0
  414. package/dist/core/argumentKinds.js +4 -4
  415. package/dist/core/argumentKinds.js.map +1 -1
  416. package/dist/core/assignment.js +8 -6
  417. package/dist/core/assignment.js.map +1 -1
  418. package/dist/core/backend.d.ts +44 -8
  419. package/dist/core/backend.js.map +1 -1
  420. package/dist/core/commandDeclaration.d.ts +8 -0
  421. package/dist/core/commandDeclaration.js.map +1 -1
  422. package/dist/core/commandParse.d.ts +34 -1
  423. package/dist/core/commandParse.js +156 -28
  424. package/dist/core/commandParse.js.map +1 -1
  425. package/dist/core/commandRegistry.d.ts +24 -5
  426. package/dist/core/commandRegistry.js +28 -5
  427. package/dist/core/commandRegistry.js.map +1 -1
  428. package/dist/core/dispatch.d.ts +1 -12
  429. package/dist/core/dispatch.js +12 -16
  430. package/dist/core/dispatch.js.map +1 -1
  431. package/dist/core/elevation.js +30 -5
  432. package/dist/core/elevation.js.map +1 -1
  433. package/dist/core/engine.d.ts +5 -11
  434. package/dist/core/engine.js +126 -50
  435. package/dist/core/engine.js.map +1 -1
  436. package/dist/core/expansion.d.ts +0 -6
  437. package/dist/core/expansion.js +0 -8
  438. package/dist/core/expansion.js.map +1 -1
  439. package/dist/core/filesystem.js +1 -1
  440. package/dist/core/filesystem.js.map +1 -1
  441. package/dist/core/handlerRun.d.ts +13 -0
  442. package/dist/core/handlerRun.js +21 -0
  443. package/dist/core/handlerRun.js.map +1 -1
  444. package/dist/core/holds.js +3 -3
  445. package/dist/core/holds.js.map +1 -1
  446. package/dist/core/hostGate.d.ts +62 -0
  447. package/dist/core/hostGate.js +72 -0
  448. package/dist/core/hostGate.js.map +1 -0
  449. package/dist/core/joblets.js +53 -27
  450. package/dist/core/joblets.js.map +1 -1
  451. package/dist/core/paths.d.ts +3 -5
  452. package/dist/core/paths.js +107 -36
  453. package/dist/core/paths.js.map +1 -1
  454. package/dist/core/preprocess.d.ts +12 -0
  455. package/dist/core/preprocess.js +42 -15
  456. package/dist/core/preprocess.js.map +1 -1
  457. package/dist/core/question.d.ts +27 -3
  458. package/dist/core/question.js +14 -6
  459. package/dist/core/question.js.map +1 -1
  460. package/dist/core/runner.d.ts +31 -7
  461. package/dist/core/runner.js +189 -37
  462. package/dist/core/runner.js.map +1 -1
  463. package/dist/core/sink.d.ts +7 -19
  464. package/dist/core/sink.js +56 -28
  465. package/dist/core/sink.js.map +1 -1
  466. package/dist/core/surface.js +1 -0
  467. package/dist/core/surface.js.map +1 -1
  468. package/dist/core/variables.js +37 -11
  469. package/dist/core/variables.js.map +1 -1
  470. package/dist/core/version.d.ts +0 -20
  471. package/dist/core/version.js +2 -26
  472. package/dist/core/version.js.map +1 -1
  473. package/dist/core/warmupFailures.d.ts +3 -6
  474. package/dist/core/warmupFailures.js.map +1 -1
  475. package/dist/core.d.ts +2 -0
  476. package/dist/core.js +2 -0
  477. package/dist/core.js.map +1 -1
  478. package/dist/index.d.ts +8 -1
  479. package/dist/index.js +8 -1
  480. package/dist/index.js.map +1 -1
  481. package/dist/lib/completer/cfsPaths.js +66 -26
  482. package/dist/lib/completer/cfsPaths.js.map +1 -1
  483. package/dist/lib/completer/declared.js +81 -20
  484. package/dist/lib/completer/declared.js.map +1 -1
  485. package/dist/lib/completer/index.d.ts +3 -0
  486. package/dist/lib/completer/index.js +44 -7
  487. package/dist/lib/completer/index.js.map +1 -1
  488. package/dist/lib/parser.d.ts +0 -16
  489. package/dist/lib/parser.js +223 -135
  490. package/dist/lib/parser.js.map +1 -1
  491. package/dist/lib/vfs/folderListing.d.ts +85 -0
  492. package/dist/lib/vfs/folderListing.js +86 -0
  493. package/dist/lib/vfs/folderListing.js.map +1 -0
  494. package/dist/lib/vfs/vfs.d.ts +37 -9
  495. package/dist/lib/vfs/vfs.js +195 -110
  496. package/dist/lib/vfs/vfs.js.map +1 -1
  497. package/dist/lib/wildcard.d.ts +7 -34
  498. package/dist/lib/wildcard.js +123 -95
  499. package/dist/lib/wildcard.js.map +1 -1
  500. package/dist/notes.json +1 -1
  501. package/dist/session/answerAdapters.js +249 -131
  502. package/dist/session/answerAdapters.js.map +1 -1
  503. package/package.json +12 -10
  504. package/dist/builtins/wildcard.d.ts +0 -8
  505. package/dist/builtins/wildcard.js +0 -9
  506. package/dist/builtins/wildcard.js.map +0 -1
  507. package/dist/lib/quoting.d.ts +0 -40
  508. package/dist/lib/quoting.js +0 -70
  509. package/dist/lib/quoting.js.map +0 -1
  510. package/dist/lib/semicolonParser.d.ts +0 -41
  511. package/dist/lib/semicolonParser.js +0 -93
  512. package/dist/lib/semicolonParser.js.map +0 -1
@@ -26,16 +26,16 @@
26
26
  *
27
27
  * @module
28
28
  */
29
- import chalk from 'chalk';
30
29
  import path from 'path';
31
- import { path_resolve, storePath_resolve } from '../utils.js';
32
- import { vfs } from '../../lib/vfs/vfs.js';
33
- import { vfsDispatcher_get } from '../../core/filesystem.js';
34
- import { spinner } from '../../lib/spinner.js';
35
- import { commandCancellation_enable, commandCancellation_signalGet } from '../../core/cancellation.js';
36
30
  import { errorStack } from '@fnndsc/fond';
37
- import { envelope_error } from '@fnndsc/menu';
31
+ import { DAG_LIVE_STATUSES, DAG_SETTLED_STATUSES, envelope_error } from '@fnndsc/menu';
32
+ import chalk from 'chalk';
33
+ import { commandCancellation_enable, commandCancellation_signalGet } from '../../core/cancellation.js';
34
+ import { vfsDispatcher_get } from '../../core/filesystem.js';
38
35
  import { exitCode_set } from '../../core/handlerRun.js';
36
+ import { spinner } from '../../lib/spinner.js';
37
+ import { vfs } from '../../lib/vfs/vfs.js';
38
+ import { path_resolve, storePath_resolve } from '../utils.js';
39
39
  /** How long a walk runs before it says how far it has got. */
40
40
  const PROGRESS_AFTER_MS = 1500;
41
41
  /** Listing types the namespace descends into. */
@@ -75,153 +75,239 @@ export function pattern_convertToRegExp(pattern, ignoreCase = false) {
75
75
  return new RegExp(`^${source}$`, ignoreCase ? 'i' : '');
76
76
  }
77
77
  /**
78
- * Parses `find`'s arguments.
79
- *
80
- * @param args - The words after `find`.
81
- * @returns The query, or the refusal to say.
78
+ * Reads `find`'s expression by recursive descent: `or` of `and` of `not` of
79
+ * a primary (a test, an action, an option, or a parenthesised expression).
80
+ * Holds the options the expression sets on the way.
82
81
  */
83
- export function find_parse(args) {
84
- const starts = [];
85
- let i = 0;
86
- while (i < args.length && !/^[-!(]/.test(args[i]))
87
- starts.push(args[i++]);
88
- if (starts.length === 0)
89
- starts.push('.');
90
- const words = args.slice(i);
91
- let at = 0;
92
- let maxdepth = Number.POSITIVE_INFINITY;
93
- let mindepth = 0;
94
- let acts = false;
95
- let asksRuns = false;
96
- let workflowId = null;
97
- const argument = (predicate) => {
98
- const value = words[++at];
82
+ class FindParser {
83
+ /** The expression's words. */
84
+ words;
85
+ /** The word being read. */
86
+ at = 0;
87
+ /** `-maxdepth`. */
88
+ maxdepth = Number.POSITIVE_INFINITY;
89
+ /** `-mindepth`. */
90
+ mindepth = 0;
91
+ /** Whether an action was named. */
92
+ acts = false;
93
+ /** Whether a test asks which pipeline run made a job. */
94
+ asksRuns = false;
95
+ /** One pipeline run asked for by id. */
96
+ workflowId = null;
97
+ /**
98
+ * Starts at the first word of the expression.
99
+ *
100
+ * @param words - The expression's words.
101
+ */
102
+ constructor(words) {
103
+ this.words = words;
104
+ }
105
+ /**
106
+ * The word left over after the expression, when one is.
107
+ *
108
+ * @returns The first word not read, or undefined when every word was.
109
+ */
110
+ get leftover() {
111
+ return this.at < this.words.length ? this.words[this.at] : undefined;
112
+ }
113
+ /**
114
+ * Takes the word after a predicate as its argument.
115
+ *
116
+ * @param predicate - The predicate, for the refusal.
117
+ * @returns The argument.
118
+ * @throws {Error} When the expression ends first.
119
+ */
120
+ argument_take(predicate) {
121
+ const value = this.words[++this.at];
99
122
  if (value === undefined)
100
123
  throw new Error(`find: ${predicate} needs an argument`);
101
124
  return value;
102
- };
103
- const depth = (predicate) => {
104
- const value = argument(predicate);
125
+ }
126
+ /**
127
+ * Takes a depth bound's number.
128
+ *
129
+ * @param predicate - The option, for the refusal.
130
+ * @returns The depth.
131
+ * @throws {Error} When the argument is missing or not a number.
132
+ */
133
+ depth_take(predicate) {
134
+ const value = this.argument_take(predicate);
105
135
  if (!/^\d+$/.test(value))
106
136
  throw new Error(`find: ${predicate} takes a number, not '${value}'`);
107
137
  return Number(value);
108
- };
109
- const primary = () => {
110
- const word = words[at];
111
- if (word === undefined)
112
- throw new Error('find: an expression ends where a test was expected');
113
- if (word === '(') {
114
- at++;
115
- const inner = or();
116
- if (words[at] !== ')')
117
- throw new Error("find: a '(' is not closed");
118
- at++;
119
- return inner;
120
- }
121
- let expr;
138
+ }
139
+ /**
140
+ * Reads a test that matches a pattern against one of an entry's fields.
141
+ *
142
+ * @param word - The predicate.
143
+ * @returns The test, or null when the predicate is not a pattern test.
144
+ * @throws {Error} When its argument is missing.
145
+ */
146
+ patternTest_read(word) {
122
147
  switch (word) {
123
148
  case '-name':
124
149
  case '-iname': {
125
- const re = pattern_convertToRegExp(argument(word), word === '-iname');
126
- expr = { kind: 'test', test: (node) => re.test(node.name) };
127
- break;
150
+ const re = pattern_convertToRegExp(this.argument_take(word), word === '-iname');
151
+ return { kind: 'test', test: (node) => re.test(node.name) };
128
152
  }
129
153
  case '-path':
130
154
  case '-ipath':
131
155
  case '-wholename': {
132
- const re = pattern_convertToRegExp(argument(word), word === '-ipath');
133
- expr = { kind: 'test', test: (node) => re.test(node.shown) };
134
- break;
135
- }
136
- case '-type': {
137
- const kind = argument(word);
138
- if (!['f', 'd', 'l'].includes(kind))
139
- throw new Error(`find: -type takes f, d or l, not '${kind}'`);
140
- expr = { kind: 'test', test: (node) => node.type === kind };
141
- break;
156
+ const re = pattern_convertToRegExp(this.argument_take(word), word === '-ipath');
157
+ return { kind: 'test', test: (node) => re.test(node.shown) };
142
158
  }
143
159
  case '-pipeline':
144
160
  case '-workflow': {
145
- const wanted = argument(word);
161
+ const wanted = this.argument_take(word);
146
162
  const re = pattern_convertToRegExp(wanted, true);
147
163
  const field = word === '-pipeline' ? 'pipeline' : 'workflow';
148
- asksRuns = true;
149
- if (field === 'workflow' && /^\d+$/.test(wanted) && workflowId === null)
150
- workflowId = Number(wanted);
151
- expr = { kind: 'test', test: (node) => node[field] !== undefined && re.test(node[field]) };
152
- break;
164
+ this.asksRuns = true;
165
+ if (field === 'workflow' && /^\d+$/.test(wanted) && this.workflowId === null)
166
+ this.workflowId = Number(wanted);
167
+ return { kind: 'test', test: (node) => node[field] !== undefined && re.test(node[field]) };
153
168
  }
154
169
  case '-status':
155
170
  case '-plugin': {
156
- const re = pattern_convertToRegExp(argument(word), true);
171
+ const re = pattern_convertToRegExp(this.argument_take(word), true);
157
172
  const field = word === '-status' ? 'status' : 'plugin';
158
- expr = { kind: 'test', test: (node) => node[field] !== undefined && re.test(node[field]) };
159
- break;
173
+ return { kind: 'test', test: (node) => node[field] !== undefined && re.test(node[field]) };
174
+ }
175
+ default: return null;
176
+ }
177
+ }
178
+ /**
179
+ * Reads one test, option or action.
180
+ *
181
+ * @param word - The predicate.
182
+ * @returns The expression it stands for.
183
+ * @throws {Error} When the predicate is unknown or its argument does not read.
184
+ */
185
+ test_read(word) {
186
+ const matched = this.patternTest_read(word);
187
+ if (matched !== null)
188
+ return matched;
189
+ switch (word) {
190
+ case '-type': {
191
+ const kind = this.argument_take(word);
192
+ if (!['f', 'd', 'l'].includes(kind))
193
+ throw new Error(`find: -type takes f, d or l, not '${kind}'`);
194
+ return { kind: 'test', test: (node) => node.type === kind };
160
195
  }
161
196
  case '-newermt': {
162
- const when = argument(word);
197
+ const when = this.argument_take(word);
163
198
  const time = Date.parse(when);
164
199
  if (Number.isNaN(time))
165
200
  throw new Error(`find: -newermt takes a date, not '${when}'`);
166
- expr = { kind: 'test', test: (node) => node.date !== undefined && Date.parse(node.date) > time };
167
- break;
201
+ return { kind: 'test', test: (node) => node.date !== undefined && Date.parse(node.date) > time };
168
202
  }
169
203
  case '-maxdepth':
170
- maxdepth = depth(word);
171
- expr = { kind: 'test', test: () => true };
172
- break;
204
+ this.maxdepth = this.depth_take(word);
205
+ return { kind: 'test', test: () => true };
173
206
  case '-mindepth':
174
- mindepth = depth(word);
175
- expr = { kind: 'test', test: () => true };
176
- break;
177
- case '-true':
178
- expr = { kind: 'test', test: () => true };
179
- break;
180
- case '-false':
181
- expr = { kind: 'test', test: () => false };
182
- break;
207
+ this.mindepth = this.depth_take(word);
208
+ return { kind: 'test', test: () => true };
209
+ case '-true': return { kind: 'test', test: () => true };
210
+ case '-false': return { kind: 'test', test: () => false };
183
211
  case '-print':
184
- acts = true;
185
- expr = { kind: 'print', separator: '\n' };
186
- break;
212
+ this.acts = true;
213
+ return { kind: 'print', separator: '\n' };
187
214
  case '-print0':
188
- acts = true;
189
- expr = { kind: 'print', separator: '\0' };
190
- break;
215
+ this.acts = true;
216
+ return { kind: 'print', separator: '\0' };
191
217
  default: throw new Error(`find: unknown predicate '${word}'`);
192
218
  }
193
- at++;
219
+ }
220
+ /**
221
+ * Reads a primary: a parenthesised expression, or one test.
222
+ *
223
+ * @returns The expression.
224
+ * @throws {Error} When the expression ends, or a parenthesis is not closed.
225
+ */
226
+ primary_read() {
227
+ const word = this.words[this.at];
228
+ if (word === undefined)
229
+ throw new Error('find: an expression ends where a test was expected');
230
+ if (word === '(') {
231
+ this.at++;
232
+ const inner = this.or_read();
233
+ if (this.words[this.at] !== ')')
234
+ throw new Error("find: a '(' is not closed");
235
+ this.at++;
236
+ return inner;
237
+ }
238
+ const expr = this.test_read(word);
239
+ this.at++;
194
240
  return expr;
195
- };
196
- const not = () => {
197
- if (words[at] === '!' || words[at] === '-not') {
198
- at++;
199
- return { kind: 'not', operand: not() };
241
+ }
242
+ /**
243
+ * Reads a negation, or a primary.
244
+ *
245
+ * @returns The expression.
246
+ */
247
+ not_read() {
248
+ if (this.words[this.at] === '!' || this.words[this.at] === '-not') {
249
+ this.at++;
250
+ return { kind: 'not', operand: this.not_read() };
200
251
  }
201
- return primary();
202
- };
203
- const and = () => {
204
- let left = not();
205
- while (at < words.length && words[at] !== '-o' && words[at] !== '-or' && words[at] !== ')') {
206
- if (words[at] === '-a' || words[at] === '-and')
207
- at++;
208
- left = { kind: 'and', left, right: not() };
252
+ return this.primary_read();
253
+ }
254
+ /**
255
+ * Reads a conjunction: implicit, or `-a`/`-and`.
256
+ *
257
+ * @returns The expression.
258
+ */
259
+ and_read() {
260
+ let left = this.not_read();
261
+ while (this.at < this.words.length && this.words[this.at] !== '-o' && this.words[this.at] !== '-or' && this.words[this.at] !== ')') {
262
+ if (this.words[this.at] === '-a' || this.words[this.at] === '-and')
263
+ this.at++;
264
+ left = { kind: 'and', left, right: this.not_read() };
209
265
  }
210
266
  return left;
211
- };
212
- const or = () => {
213
- let left = and();
214
- while (words[at] === '-o' || words[at] === '-or') {
215
- at++;
216
- left = { kind: 'or', left, right: and() };
267
+ }
268
+ /**
269
+ * Reads a disjunction: `-o`/`-or`.
270
+ *
271
+ * @returns The expression.
272
+ */
273
+ or_read() {
274
+ let left = this.and_read();
275
+ while (this.words[this.at] === '-o' || this.words[this.at] === '-or') {
276
+ this.at++;
277
+ left = { kind: 'or', left, right: this.and_read() };
217
278
  }
218
279
  return left;
219
- };
280
+ }
281
+ /**
282
+ * Reads the whole expression; an empty one is true.
283
+ *
284
+ * @returns The expression.
285
+ * @throws {Error} When the expression does not read.
286
+ */
287
+ expression_read() {
288
+ return this.words.length === 0 ? { kind: 'test', test: () => true } : this.or_read();
289
+ }
290
+ }
291
+ /**
292
+ * Parses `find`'s arguments.
293
+ *
294
+ * @param args - The words after `find`.
295
+ * @returns The query, or the refusal to say.
296
+ */
297
+ export function find_parse(args) {
298
+ const starts = [];
299
+ let i = 0;
300
+ while (i < args.length && !/^[-!(]/.test(args[i]))
301
+ starts.push(args[i++]);
302
+ if (starts.length === 0)
303
+ starts.push('.');
304
+ const parser = new FindParser(args.slice(i));
220
305
  try {
221
- const expr = words.length === 0 ? { kind: 'test', test: () => true } : or();
222
- if (at < words.length)
223
- return `find: unexpected '${words[at]}'`;
224
- return { starts, expr, maxdepth, mindepth, acts, asksRuns, workflowId };
306
+ const expr = parser.expression_read();
307
+ const leftover = parser.leftover;
308
+ if (leftover !== undefined)
309
+ return `find: unexpected '${leftover}'`;
310
+ return { starts, expr, maxdepth: parser.maxdepth, mindepth: parser.mindepth, acts: parser.acts, asksRuns: parser.asksRuns, workflowId: parser.workflowId };
225
311
  }
226
312
  catch (error) {
227
313
  return error instanceof Error ? error.message : String(error);
@@ -246,19 +332,275 @@ export function find_evaluate(expr, node, out) {
246
332
  return true;
247
333
  }
248
334
  }
249
- /** The plugin a `/proc/jobs` job ran, read from its name (`pl-x_10`). */
335
+ /**
336
+ * The plugin a `/proc/jobs` job ran, read from its name (`pl-x_10`).
337
+ *
338
+ * @param item - The listed entry.
339
+ * @returns The plugin's name, or undefined when the entry is no job.
340
+ */
250
341
  function pluginName_parse(item) {
251
342
  if (item.type !== 'job' || /^feed_\d+$/.test(item.name))
252
343
  return undefined;
253
344
  const match = /^(.+)_\d+$/.exec(item.name);
254
345
  return match === null ? undefined : match[1];
255
346
  }
256
- /** An entry's kind, as `-type` names it. */
347
+ /**
348
+ * An entry's kind, as `-type` names it.
349
+ *
350
+ * @param item - The listed entry.
351
+ * @returns `l` a link, `d` a folder, `f` anything else.
352
+ */
257
353
  function itemType_derive(item) {
258
354
  if (item.type === 'link')
259
355
  return 'l';
260
356
  return FOLDER_TYPES.has(item.type) ? 'd' : 'f';
261
357
  }
358
+ /**
359
+ * Leaves a node as the walk made it: the judge of a walk with no run to consult.
360
+ *
361
+ * @param node - The entry.
362
+ * @returns The same entry.
363
+ */
364
+ function node_keep(node) {
365
+ return node;
366
+ }
367
+ /**
368
+ * One `find` walk: what it printed, what failed, how far it has got, and
369
+ * the jobs a run test could not judge. Depth first, in listing order: an
370
+ * entry, then everything beneath it.
371
+ */
372
+ class FindWalk {
373
+ /** The query walked. */
374
+ query;
375
+ /** Ctrl-C (or STOP), when the walk can be stopped. */
376
+ signal;
377
+ /** The paths printed, each with its separator. */
378
+ out = [];
379
+ /** Every failure, said in order. */
380
+ failures = '';
381
+ /** Folders listed so far. */
382
+ folders = 0;
383
+ /** Entries printed so far. */
384
+ found = 0;
385
+ /** When the walk began. */
386
+ startedAt = Date.now();
387
+ /** Whether the walk has said how far it has got. */
388
+ announced = false;
389
+ /** Jobs a -pipeline or -workflow test could not judge: their run is not known yet. */
390
+ unjudged = 0;
391
+ /**
392
+ * Starts a walk.
393
+ *
394
+ * @param query - The query.
395
+ * @param signal - Ctrl-C (or STOP).
396
+ */
397
+ constructor(query, signal) {
398
+ this.query = query;
399
+ this.signal = signal;
400
+ }
401
+ /**
402
+ * Says how far the walk has got, once it has run long enough to need saying.
403
+ */
404
+ progress_say() {
405
+ if (Date.now() - this.startedAt < PROGRESS_AFTER_MS)
406
+ return;
407
+ const words = `find: ${this.folders} folder${this.folders === 1 ? '' : 's'} walked, ${this.found} found`;
408
+ if (this.announced)
409
+ spinner.updateMessage(words);
410
+ else {
411
+ spinner.start(words);
412
+ this.announced = true;
413
+ }
414
+ }
415
+ /**
416
+ * Visits one entry: tested, and printed as the expression says.
417
+ *
418
+ * @param node - The entry.
419
+ */
420
+ node_visit(node) {
421
+ if (this.query.asksRuns && node.plugin !== undefined && node.pipeline === undefined && node.workflow === undefined)
422
+ this.unjudged++;
423
+ if (node.depth < this.query.mindepth)
424
+ return;
425
+ const before = this.out.length;
426
+ const matched = find_evaluate(this.query.expr, node, this.out);
427
+ if (!this.query.acts && matched)
428
+ this.out.push(`${node.shown}\n`);
429
+ if (this.out.length > before)
430
+ this.found++;
431
+ }
432
+ /**
433
+ * Notes that the walk was stopped, and how far it had got.
434
+ */
435
+ stopped_note() {
436
+ this.failures += `find: stopped (Ctrl-C) after ${this.folders} folders; ${this.found} found so far\n`;
437
+ }
438
+ /**
439
+ * Walks a folder: each entry, then everything beneath it.
440
+ *
441
+ * @param real - Where the folder is listed.
442
+ * @param shown - How its path is printed.
443
+ * @param depth - Its level below the starting point.
444
+ * @param judge - What a job's run is, when a run test asked.
445
+ * @returns False when the walk was stopped.
446
+ */
447
+ async folder_walk(real, shown, depth, judge = node_keep) {
448
+ if (this.signal?.aborted)
449
+ return false;
450
+ if (depth >= this.query.maxdepth)
451
+ return true;
452
+ const listed = await vfs.listing_get(real);
453
+ this.folders++;
454
+ this.progress_say();
455
+ if (!listed.ok) {
456
+ const why = errorStack.stack_pop()?.message ?? 'cannot be read';
457
+ this.failures += `find: '${shown}': ${why}\n`;
458
+ return true;
459
+ }
460
+ for (const item of listed.value.items) {
461
+ const node = judge({
462
+ shown: shown === '/' ? `/${item.name}` : `${shown}/${item.name}`,
463
+ name: item.name,
464
+ type: itemType_derive(item),
465
+ date: item.date || undefined,
466
+ depth: depth + 1,
467
+ status: typeof item.status === 'string' ? item.status : undefined,
468
+ plugin: pluginName_parse(item),
469
+ });
470
+ this.node_visit(node);
471
+ if (node.type === 'd' && !(await this.folder_walk(path.posix.join(real, item.name), node.shown, node.depth, judge)))
472
+ return false;
473
+ }
474
+ return true;
475
+ }
476
+ /**
477
+ * Walks one pipeline run asked for by id under /proc/jobs: CUBE names the
478
+ * run's jobs and the feeds they are in, and only those feeds are read, each
479
+ * resolving alone, whether or not the index is built; every other feed is
480
+ * left alone (#1364: a cold session indexed them all first, minutes before
481
+ * the first line). Each job walked is judged by the run's own list, so the
482
+ * test needs no index either.
483
+ *
484
+ * @param resolved - Where /proc/jobs is listed.
485
+ * @param shownRoot - How it is printed.
486
+ * @param workflowId - The run.
487
+ * @returns False when the walk was stopped.
488
+ */
489
+ async workflowRun_walk(resolved, shownRoot, workflowId) {
490
+ // Read when asked, not at load: find's other walks owe salsa nothing.
491
+ const { workflowJobs_get } = await import('@fnndsc/salsa');
492
+ const run = await workflowJobs_get(workflowId);
493
+ const jobs = new Set(run.jobs);
494
+ const judge = (node) => {
495
+ if (node.plugin === undefined)
496
+ return node;
497
+ const id = Number(/_(\d+)$/.exec(node.name)?.[1] ?? NaN);
498
+ return { ...node, workflow: jobs.has(id) ? String(workflowId) : '' };
499
+ };
500
+ for (const feedId of run.feeds) {
501
+ const rel = `feed_${feedId}`;
502
+ this.node_visit({ shown: shownRoot === '/' ? `/${rel}` : `${shownRoot}/${rel}`, name: rel, type: 'd', depth: 1 });
503
+ if (!(await this.folder_walk(path.posix.join(resolved, rel), shownRoot === '/' ? `/${rel}` : `${shownRoot}/${rel}`, 1, judge))) {
504
+ this.stopped_note();
505
+ return false;
506
+ }
507
+ }
508
+ return true;
509
+ }
510
+ /**
511
+ * Walks a subtree a mount holds whole (/proc/jobs, from its cache): its
512
+ * entries visited as answered, and only what it left unanswered walked.
513
+ *
514
+ * @param resolved - Where the subtree is listed.
515
+ * @param shownRoot - How it is printed.
516
+ * @param held - What the mount answered.
517
+ * @returns False when the walk was stopped.
518
+ */
519
+ async heldSubtree_walk(resolved, shownRoot, held) {
520
+ const join = (base, rel) => (base === '/' ? `/${rel}` : `${base}/${rel}`);
521
+ for (const entry of held.entries) {
522
+ if (entry.depth > this.query.maxdepth)
523
+ continue;
524
+ this.node_visit({
525
+ shown: join(shownRoot, entry.rel),
526
+ name: entry.item.name,
527
+ type: itemType_derive(entry.item),
528
+ date: entry.item.date || undefined,
529
+ depth: entry.depth,
530
+ status: entry.attrs?.['status'] ?? entry.item.status,
531
+ plugin: entry.attrs?.['plugin'],
532
+ pipeline: entry.attrs?.['pipeline'],
533
+ workflow: entry.attrs?.['workflow'],
534
+ });
535
+ }
536
+ for (const rel of held.unanswered) {
537
+ const depth = rel.split('/').length;
538
+ if (!(await this.folder_walk(path.posix.join(resolved, rel), join(shownRoot, rel), depth))) {
539
+ this.stopped_note();
540
+ return false;
541
+ }
542
+ }
543
+ return true;
544
+ }
545
+ /**
546
+ * Walks from one starting point, where the store keeps it: a run's data
547
+ * path, a link on the line.
548
+ *
549
+ * @param start - The starting point as typed.
550
+ * @returns False when the walk was stopped, and no later start is walked.
551
+ */
552
+ async start_walk(start) {
553
+ const resolved = await storePath_resolve(start);
554
+ const logical = await path_resolve(start);
555
+ const shownRoot = start.startsWith('~') ? logical : start;
556
+ const self = await vfs.listing_get(resolved, { directory: true });
557
+ const entry = self.ok ? self.value.items[0] : undefined;
558
+ if (entry === undefined) {
559
+ errorStack.stack_pop();
560
+ this.failures += `find: '${start}': No such file or directory\n`;
561
+ return true;
562
+ }
563
+ const rootType = itemType_derive(entry);
564
+ this.node_visit({ shown: shownRoot, name: path.posix.basename(logical) || logical, type: rootType, date: entry.date || undefined, depth: 0 });
565
+ if (rootType !== 'd')
566
+ return true;
567
+ if (this.query.workflowId !== null && resolved === '/proc/jobs')
568
+ return this.workflowRun_walk(resolved, shownRoot, this.query.workflowId);
569
+ const held = await vfsDispatcher_get().subtree(resolved).catch(() => null);
570
+ if (held !== null)
571
+ return this.heldSubtree_walk(resolved, shownRoot, held);
572
+ if (!(await this.folder_walk(resolved, shownRoot, 0))) {
573
+ this.stopped_note();
574
+ return false;
575
+ }
576
+ return true;
577
+ }
578
+ /**
579
+ * Stops the progress line, when the walk said one.
580
+ */
581
+ progress_end() {
582
+ if (this.announced)
583
+ spinner.stop();
584
+ }
585
+ /**
586
+ * The walk's envelope: the paths printed, and the failures (and the jobs
587
+ * left unjudged, which are not a failure: said, so an answer that leaves
588
+ * jobs out never looks whole).
589
+ *
590
+ * @returns An error envelope when any part of the walk failed, ok otherwise.
591
+ */
592
+ envelope_build() {
593
+ const unjudged = this.unjudged;
594
+ const unjudgedNote = unjudged > 0
595
+ ? `find: ${unjudged} job${unjudged === 1 ? '' : 's'} not judged: which pipeline run made ${unjudged === 1 ? 'it' : 'them'} is not known yet (being read now, behind the prompt); asked again, find judges ${unjudged === 1 ? 'it' : 'them'} too\n`
596
+ : '';
597
+ if (this.failures !== '')
598
+ exitCode_set(1);
599
+ const failures = this.failures + unjudgedNote;
600
+ const failed = failures !== unjudgedNote;
601
+ return { status: failed ? 'error' : 'ok', rendered: this.out.join(''), renderedErr: failures === '' ? undefined : (failed ? chalk.red(failures) : chalk.yellow(failures)) };
602
+ }
603
+ }
262
604
  /**
263
605
  * `find [path...] [expression]`.
264
606
  *
@@ -272,168 +614,17 @@ export async function builtin_find(args) {
272
614
  return envelope_error('', undefined, `${chalk.red(query)}\n`);
273
615
  }
274
616
  commandCancellation_enable();
275
- const signal = commandCancellation_signalGet();
276
- const out = [];
277
- let failures = '';
278
- let folders = 0;
279
- let found = 0;
280
- const startedAt = Date.now();
281
- let announced = false;
282
- const progress = () => {
283
- if (Date.now() - startedAt < PROGRESS_AFTER_MS)
284
- return;
285
- const words = `find: ${folders} folder${folders === 1 ? '' : 's'} walked, ${found} found`;
286
- if (announced)
287
- spinner.updateMessage(words);
288
- else {
289
- spinner.start(words);
290
- announced = true;
291
- }
292
- };
293
- // Jobs a -pipeline or -workflow test could not judge: their run is not known yet.
294
- let unjudged = 0;
295
- const visit = (node) => {
296
- if (query.asksRuns && node.plugin !== undefined && node.pipeline === undefined && node.workflow === undefined)
297
- unjudged++;
298
- if (node.depth < query.mindepth)
299
- return;
300
- const before = out.length;
301
- const matched = find_evaluate(query.expr, node, out);
302
- if (!query.acts && matched)
303
- out.push(`${node.shown}\n`);
304
- if (out.length > before)
305
- found++;
306
- };
617
+ const walk = new FindWalk(query, commandCancellation_signalGet());
307
618
  try {
308
619
  for (const start of query.starts) {
309
- // Walked where the store keeps it: a run's data path, a link on the line.
310
- const resolved = await storePath_resolve(start);
311
- const logical = await path_resolve(start);
312
- const shownRoot = start.startsWith('~') ? logical : start;
313
- const self = await vfs.listing_get(resolved, { directory: true });
314
- const entry = self.ok ? self.value.items[0] : undefined;
315
- if (entry === undefined) {
316
- errorStack.stack_pop();
317
- failures += `find: '${start}': No such file or directory\n`;
318
- continue;
319
- }
320
- const rootType = itemType_derive(entry);
321
- visit({ shown: shownRoot, name: path.posix.basename(logical) || logical, type: rootType, date: entry.date || undefined, depth: 0 });
322
- if (rootType !== 'd')
323
- continue;
324
- // Depth first, in listing order: an entry, then everything beneath it.
325
- const walk = async (real, shown, depth, judge = (node) => node) => {
326
- if (signal?.aborted)
327
- return false;
328
- if (depth >= query.maxdepth)
329
- return true;
330
- const listed = await vfs.listing_get(real);
331
- folders++;
332
- progress();
333
- if (!listed.ok) {
334
- const why = errorStack.stack_pop()?.message ?? 'cannot be read';
335
- failures += `find: '${shown}': ${why}\n`;
336
- return true;
337
- }
338
- for (const item of listed.value.items) {
339
- const node = judge({
340
- shown: shown === '/' ? `/${item.name}` : `${shown}/${item.name}`,
341
- name: item.name,
342
- type: itemType_derive(item),
343
- date: item.date || undefined,
344
- depth: depth + 1,
345
- status: typeof item.status === 'string' ? item.status : undefined,
346
- plugin: pluginName_parse(item),
347
- });
348
- visit(node);
349
- if (node.type === 'd' && !(await walk(path.posix.join(real, item.name), node.shown, node.depth, judge)))
350
- return false;
351
- }
352
- return true;
353
- };
354
- // A mount that holds the subtree answers it whole (/proc/jobs, from
355
- // its cache); only what it leaves unanswered is walked.
356
- // One pipeline run asked for by id under /proc/jobs: CUBE names the run's jobs and the feeds they are in, and
357
- // only those feeds are read, each resolving alone, whether or not the index is built; every other feed is left
358
- // alone (#1364: a cold session indexed them all first, minutes before the first line). Each job walked is
359
- // judged by the run's own list, so the test needs no index either.
360
- if (query.workflowId !== null && resolved === '/proc/jobs') {
361
- // Read when asked, not at load: find's other walks owe salsa nothing.
362
- const { workflowJobs_get } = await import('@fnndsc/salsa');
363
- const run = await workflowJobs_get(query.workflowId);
364
- const jobs = new Set(run.jobs);
365
- const judge = (node) => {
366
- if (node.plugin === undefined)
367
- return node;
368
- const id = Number(/_(\d+)$/.exec(node.name)?.[1] ?? NaN);
369
- return { ...node, workflow: jobs.has(id) ? String(query.workflowId) : '' };
370
- };
371
- let stopped = false;
372
- for (const feedId of run.feeds) {
373
- const rel = `feed_${feedId}`;
374
- visit({ shown: shownRoot === '/' ? `/${rel}` : `${shownRoot}/${rel}`, name: rel, type: 'd', depth: 1 });
375
- if (!(await walk(path.posix.join(resolved, rel), shownRoot === '/' ? `/${rel}` : `${shownRoot}/${rel}`, 1, judge))) {
376
- stopped = true;
377
- break;
378
- }
379
- }
380
- if (stopped) {
381
- failures += `find: stopped (Ctrl-C) after ${folders} folders; ${found} found so far\n`;
382
- break;
383
- }
384
- continue;
385
- }
386
- const held = await vfsDispatcher_get().subtree(resolved).catch(() => null);
387
- if (held !== null) {
388
- const join = (base, rel) => (base === '/' ? `/${rel}` : `${base}/${rel}`);
389
- for (const entry of held.entries) {
390
- if (entry.depth > query.maxdepth)
391
- continue;
392
- visit({
393
- shown: join(shownRoot, entry.rel),
394
- name: entry.item.name,
395
- type: itemType_derive(entry.item),
396
- date: entry.item.date || undefined,
397
- depth: entry.depth,
398
- status: entry.attrs?.['status'] ?? entry.item.status,
399
- plugin: entry.attrs?.['plugin'],
400
- pipeline: entry.attrs?.['pipeline'],
401
- workflow: entry.attrs?.['workflow'],
402
- });
403
- }
404
- let stopped = false;
405
- for (const rel of held.unanswered) {
406
- const depth = rel.split('/').length;
407
- if (!(await walk(path.posix.join(resolved, rel), join(shownRoot, rel), depth))) {
408
- stopped = true;
409
- break;
410
- }
411
- }
412
- if (stopped) {
413
- failures += `find: stopped (Ctrl-C) after ${folders} folders; ${found} found so far\n`;
414
- break;
415
- }
416
- continue;
417
- }
418
- if (!(await walk(resolved, shownRoot, 0))) {
419
- failures += `find: stopped (Ctrl-C) after ${folders} folders; ${found} found so far\n`;
620
+ if (!(await walk.start_walk(start)))
420
621
  break;
421
- }
422
622
  }
423
623
  }
424
624
  finally {
425
- if (announced)
426
- spinner.stop();
625
+ walk.progress_end();
427
626
  }
428
- // Not a failure: said, so an answer that leaves jobs out never looks whole.
429
- const unjudgedNote = unjudged > 0
430
- ? `find: ${unjudged} job${unjudged === 1 ? '' : 's'} not judged: which pipeline run made ${unjudged === 1 ? 'it' : 'them'} is not known yet (being read now, behind the prompt); asked again, find judges ${unjudged === 1 ? 'it' : 'them'} too\n`
431
- : '';
432
- if (failures !== '')
433
- exitCode_set(1);
434
- failures += unjudgedNote;
435
- const failed = failures !== unjudgedNote;
436
- return { status: failed ? 'error' : 'ok', rendered: out.join(''), renderedErr: failures === '' ? undefined : (failed ? chalk.red(failures) : chalk.yellow(failures)) };
627
+ return walk.envelope_build();
437
628
  }
438
629
  /** find's tests, operators and actions, as completion offers them. */
439
630
  const FIND_PRIMARIES = [
@@ -444,8 +635,8 @@ const FIND_PRIMARIES = [
444
635
  const FIND_TAKES_ARGUMENT = new Set([
445
636
  '-name', '-iname', '-path', '-ipath', '-wholename', '-type', '-newermt', '-status', '-plugin', '-pipeline', '-workflow', '-maxdepth', '-mindepth',
446
637
  ]);
447
- /** The statuses `-status` most often asks for. */
448
- const FIND_STATUSES = ['finishedSuccessfully', 'finishedWithError', 'started', 'scheduled', 'waiting', 'cancelled'];
638
+ /** The statuses `-status` completes: every CUBE job status but `unknown`. */
639
+ const FIND_STATUSES = [...DAG_LIVE_STATUSES, ...DAG_SETTLED_STATUSES];
449
640
  /**
450
641
  * Completes one word of a `find` line: a path among the starting points, a
451
642
  * test or operator once the expression has begun (or when a dash is typed),