@fnndsc/brasa 0.57.3 → 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.
- package/dist/api/models.d.ts +2 -3
- package/dist/api/models.js.map +1 -1
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/argumentTokens.js +25 -6
- package/dist/builtins/argumentTokens.js.map +1 -1
- package/dist/builtins/berth/berth.d.ts +0 -14
- package/dist/builtins/berth/berth.js +255 -88
- package/dist/builtins/berth/berth.js.map +1 -1
- package/dist/builtins/berth/berthClose.d.ts +66 -1
- package/dist/builtins/berth/berthClose.js +312 -26
- package/dist/builtins/berth/berthClose.js.map +1 -1
- package/dist/builtins/berth/berthClosed.d.ts +212 -0
- package/dist/builtins/berth/berthClosed.js +231 -0
- package/dist/builtins/berth/berthClosed.js.map +1 -0
- package/dist/builtins/berth/berthCube.js +27 -6
- package/dist/builtins/berth/berthCube.js.map +1 -1
- package/dist/builtins/berth/berthDisk.js +1 -1
- package/dist/builtins/berth/berthDisk.js.map +1 -1
- package/dist/builtins/berth/berthProcesses.js +15 -3
- package/dist/builtins/berth/berthProcesses.js.map +1 -1
- package/dist/builtins/berth/berthRecord.d.ts +14 -2
- package/dist/builtins/berth/berthRecord.js +20 -5
- package/dist/builtins/berth/berthRecord.js.map +1 -1
- package/dist/builtins/berth/berthState.d.ts +26 -6
- package/dist/builtins/berth/berthState.js +47 -13
- package/dist/builtins/berth/berthState.js.map +1 -1
- package/dist/builtins/debug.d.ts +0 -8
- package/dist/builtins/debug.js +1 -12
- package/dist/builtins/debug.js.map +1 -1
- package/dist/builtins/executable.js +102 -75
- package/dist/builtins/executable.js.map +1 -1
- package/dist/builtins/feedTotals.js +30 -25
- package/dist/builtins/feedTotals.js.map +1 -1
- package/dist/builtins/fs/acl.args.d.ts +3 -10
- package/dist/builtins/fs/acl.args.js +16 -24
- package/dist/builtins/fs/acl.args.js.map +1 -1
- package/dist/builtins/fs/acl.d.ts +0 -37
- package/dist/builtins/fs/acl.js +36 -58
- package/dist/builtins/fs/acl.js.map +1 -1
- package/dist/builtins/fs/archive.js +25 -9
- package/dist/builtins/fs/archive.js.map +1 -1
- package/dist/builtins/fs/cat.d.ts +0 -16
- package/dist/builtins/fs/cat.js +163 -96
- package/dist/builtins/fs/cat.js.map +1 -1
- package/dist/builtins/fs/cd.js +23 -5
- package/dist/builtins/fs/cd.js.map +1 -1
- package/dist/builtins/fs/configWrite.d.ts +0 -8
- package/dist/builtins/fs/configWrite.js +33 -46
- package/dist/builtins/fs/configWrite.js.map +1 -1
- package/dist/builtins/fs/cp.d.ts +6 -10
- package/dist/builtins/fs/cp.js +83 -86
- package/dist/builtins/fs/cp.js.map +1 -1
- package/dist/builtins/fs/deliveryIntent.d.ts +24 -0
- package/dist/builtins/fs/deliveryIntent.js +182 -0
- package/dist/builtins/fs/deliveryIntent.js.map +1 -0
- package/dist/builtins/fs/deliveryMatch.d.ts +138 -0
- package/dist/builtins/fs/deliveryMatch.js +135 -0
- package/dist/builtins/fs/deliveryMatch.js.map +1 -0
- package/dist/builtins/fs/destination.d.ts +37 -1
- package/dist/builtins/fs/destination.js +80 -0
- package/dist/builtins/fs/destination.js.map +1 -1
- package/dist/builtins/fs/download.d.ts +19 -8
- package/dist/builtins/fs/download.js +142 -72
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/du.d.ts +0 -8
- package/dist/builtins/fs/du.js +23 -20
- package/dist/builtins/fs/du.js.map +1 -1
- package/dist/builtins/fs/edit.js +117 -50
- package/dist/builtins/fs/edit.js.map +1 -1
- package/dist/builtins/fs/entries.d.ts +38 -0
- package/dist/builtins/fs/entries.js +48 -1
- package/dist/builtins/fs/entries.js.map +1 -1
- package/dist/builtins/fs/find.d.ts +1 -1
- package/dist/builtins/fs/find.js +462 -271
- package/dist/builtins/fs/find.js.map +1 -1
- package/dist/builtins/fs/ls.d.ts +2 -8
- package/dist/builtins/fs/ls.js +144 -93
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/mkdir.d.ts +2 -7
- package/dist/builtins/fs/mkdir.js +110 -58
- package/dist/builtins/fs/mkdir.js.map +1 -1
- package/dist/builtins/fs/mv.d.ts +7 -10
- package/dist/builtins/fs/mv.js +155 -100
- package/dist/builtins/fs/mv.js.map +1 -1
- package/dist/builtins/fs/pull.js +155 -92
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/fs/pwd.d.ts +0 -7
- package/dist/builtins/fs/pwd.js +0 -12
- package/dist/builtins/fs/pwd.js.map +1 -1
- package/dist/builtins/fs/rm.d.ts +6 -7
- package/dist/builtins/fs/rm.js +364 -174
- package/dist/builtins/fs/rm.js.map +1 -1
- package/dist/builtins/fs/rmdir.d.ts +0 -7
- package/dist/builtins/fs/rmdir.js +40 -21
- package/dist/builtins/fs/rmdir.js.map +1 -1
- package/dist/builtins/fs/touch.d.ts +0 -7
- package/dist/builtins/fs/touch.js +14 -27
- package/dist/builtins/fs/touch.js.map +1 -1
- package/dist/builtins/fs/transferJobs.d.ts +12 -0
- package/dist/builtins/fs/transferJobs.js +19 -0
- package/dist/builtins/fs/transferJobs.js.map +1 -1
- package/dist/builtins/fs/tree.d.ts +0 -8
- package/dist/builtins/fs/tree.js +1 -12
- package/dist/builtins/fs/tree.js.map +1 -1
- package/dist/builtins/fs/upload.d.ts +0 -8
- package/dist/builtins/fs/upload.js +23 -20
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/fs/url.d.ts +14 -2
- package/dist/builtins/fs/url.js +6 -8
- package/dist/builtins/fs/url.js.map +1 -1
- package/dist/builtins/fs/writeReport.d.ts +40 -0
- package/dist/builtins/fs/writeReport.js +71 -0
- package/dist/builtins/fs/writeReport.js.map +1 -0
- package/dist/builtins/fs/xattr.args.d.ts +14 -13
- package/dist/builtins/fs/xattr.args.js +3 -24
- package/dist/builtins/fs/xattr.args.js.map +1 -1
- package/dist/builtins/fs/xattr.d.ts +0 -25
- package/dist/builtins/fs/xattr.js +82 -65
- package/dist/builtins/fs/xattr.js.map +1 -1
- package/dist/builtins/games/bytes.d.ts +0 -55
- package/dist/builtins/games/bytes.js +95 -120
- package/dist/builtins/games/bytes.js.map +1 -1
- package/dist/builtins/games/chimes.d.ts +0 -36
- package/dist/builtins/games/chimes.js +58 -64
- package/dist/builtins/games/chimes.js.map +1 -1
- package/dist/builtins/games/chrislab.d.ts +0 -12
- package/dist/builtins/games/chrislab.js +0 -14
- package/dist/builtins/games/chrislab.js.map +1 -1
- package/dist/builtins/games/cowsay.d.ts +0 -24
- package/dist/builtins/games/cowsay.js +0 -29
- package/dist/builtins/games/cowsay.js.map +1 -1
- package/dist/builtins/games/figlet.d.ts +0 -24
- package/dist/builtins/games/figlet.js +0 -29
- package/dist/builtins/games/figlet.js.map +1 -1
- package/dist/builtins/games/lab.d.ts +0 -36
- package/dist/builtins/games/lab.js +0 -43
- package/dist/builtins/games/lab.js.map +1 -1
- package/dist/builtins/games/lolcat.d.ts +0 -12
- package/dist/builtins/games/lolcat.js +2 -17
- package/dist/builtins/games/lolcat.js.map +1 -1
- package/dist/builtins/games/numbers.d.ts +0 -60
- package/dist/builtins/games/numbers.js +0 -71
- package/dist/builtins/games/numbers.js.map +1 -1
- package/dist/builtins/games/play.d.ts +0 -36
- package/dist/builtins/games/play.js +47 -58
- package/dist/builtins/games/play.js.map +1 -1
- package/dist/builtins/games/qr.d.ts +0 -12
- package/dist/builtins/games/qr.js +189 -68
- package/dist/builtins/games/qr.js.map +1 -1
- package/dist/builtins/games/show.d.ts +0 -73
- package/dist/builtins/games/show.js +0 -85
- package/dist/builtins/games/show.js.map +1 -1
- package/dist/builtins/games/sky.d.ts +0 -36
- package/dist/builtins/games/sky.js +25 -45
- package/dist/builtins/games/sky.js.map +1 -1
- package/dist/builtins/games/text.d.ts +0 -72
- package/dist/builtins/games/text.js +0 -85
- package/dist/builtins/games/text.js.map +1 -1
- package/dist/builtins/games/trek.d.ts +0 -12
- package/dist/builtins/games/trek.js +0 -15
- package/dist/builtins/games/trek.js.map +1 -1
- package/dist/builtins/games/wtf.d.ts +0 -12
- package/dist/builtins/games/wtf.js +0 -15
- package/dist/builtins/games/wtf.js.map +1 -1
- package/dist/builtins/help.d.ts +0 -19
- package/dist/builtins/help.js +56 -39
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/helpSections.js +13 -1
- package/dist/builtins/helpSections.js.map +1 -1
- package/dist/builtins/index.d.ts +1 -1
- package/dist/builtins/index.js +1 -1
- package/dist/builtins/index.js.map +1 -1
- package/dist/builtins/net/connect.d.ts +1 -8
- package/dist/builtins/net/connect.js +2 -13
- package/dist/builtins/net/connect.js.map +1 -1
- package/dist/builtins/net/cubepath.js +30 -20
- package/dist/builtins/net/cubepath.js.map +1 -1
- package/dist/builtins/net/logout.d.ts +0 -8
- package/dist/builtins/net/logout.js +1 -12
- package/dist/builtins/net/logout.js.map +1 -1
- package/dist/builtins/net/netstat.d.ts +0 -8
- package/dist/builtins/net/netstat.js +1 -12
- package/dist/builtins/net/netstat.js.map +1 -1
- package/dist/builtins/net/pacs.d.ts +3 -17
- package/dist/builtins/net/pacs.js +50 -42
- package/dist/builtins/net/pacs.js.map +1 -1
- package/dist/builtins/net/pacsUtils.d.ts +0 -2
- package/dist/builtins/net/pacsUtils.js +67 -30
- package/dist/builtins/net/pacsUtils.js.map +1 -1
- package/dist/builtins/net/query.anon.d.ts +61 -0
- package/dist/builtins/net/query.anon.js +362 -0
- package/dist/builtins/net/query.anon.js.map +1 -0
- package/dist/builtins/net/query.args.d.ts +2 -1
- package/dist/builtins/net/query.args.js +1 -1
- package/dist/builtins/net/query.args.js.map +1 -1
- package/dist/builtins/net/query.cohort.d.ts +125 -0
- package/dist/builtins/net/query.cohort.js +267 -0
- package/dist/builtins/net/query.cohort.js.map +1 -0
- package/dist/builtins/net/query.csv.d.ts +26 -5
- package/dist/builtins/net/query.csv.js +61 -115
- package/dist/builtins/net/query.csv.js.map +1 -1
- package/dist/builtins/net/query.d.ts +27 -34
- package/dist/builtins/net/query.deliver.d.ts +96 -0
- package/dist/builtins/net/query.deliver.js +188 -0
- package/dist/builtins/net/query.deliver.js.map +1 -0
- package/dist/builtins/net/query.fanout.d.ts +32 -0
- package/dist/builtins/net/query.fanout.js +91 -0
- package/dist/builtins/net/query.fanout.js.map +1 -1
- package/dist/builtins/net/query.held.d.ts +60 -0
- package/dist/builtins/net/query.held.js +125 -0
- package/dist/builtins/net/query.held.js.map +1 -0
- package/dist/builtins/net/query.ignored.d.ts +3 -1
- package/dist/builtins/net/query.ignored.js +9 -3
- package/dist/builtins/net/query.ignored.js.map +1 -1
- package/dist/builtins/net/query.js +360 -634
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/net/query.model.d.ts +15 -0
- package/dist/builtins/net/query.model.js +109 -46
- package/dist/builtins/net/query.model.js.map +1 -1
- package/dist/builtins/net/query.view.js +29 -8
- package/dist/builtins/net/query.view.js.map +1 -1
- package/dist/builtins/operandRuns.js +4 -3
- package/dist/builtins/operandRuns.js.map +1 -1
- package/dist/builtins/operands.js +97 -39
- package/dist/builtins/operands.js.map +1 -1
- package/dist/builtins/pluginExecute.js +311 -205
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/proc.d.ts +1 -13
- package/dist/builtins/proc.helpers.d.ts +0 -7
- package/dist/builtins/proc.helpers.js +0 -10
- package/dist/builtins/proc.helpers.js.map +1 -1
- package/dist/builtins/proc.js +159 -116
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/procWatch.d.ts +2 -2
- package/dist/builtins/procWatch.js +54 -13
- package/dist/builtins/procWatch.js.map +1 -1
- package/dist/builtins/res/compute.d.ts +0 -13
- package/dist/builtins/res/compute.js +0 -16
- package/dist/builtins/res/compute.js.map +1 -1
- package/dist/builtins/res/diagram.tree.js +36 -12
- package/dist/builtins/res/diagram.tree.js.map +1 -1
- package/dist/builtins/res/dicom.d.ts +24 -17
- package/dist/builtins/res/dicom.js +78 -79
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/res/expect.d.ts +8 -17
- package/dist/builtins/res/expect.js +173 -101
- package/dist/builtins/res/expect.js.map +1 -1
- package/dist/builtins/res/feed.d.ts +0 -13
- package/dist/builtins/res/feed.diagram.js +89 -57
- package/dist/builtins/res/feed.diagram.js.map +1 -1
- package/dist/builtins/res/feed.js +61 -42
- package/dist/builtins/res/feed.js.map +1 -1
- package/dist/builtins/res/feed.tree.collapse.d.ts +0 -10
- package/dist/builtins/res/feed.tree.collapse.js +12 -5
- package/dist/builtins/res/feed.tree.collapse.js.map +1 -1
- package/dist/builtins/res/files.d.ts +0 -37
- package/dist/builtins/res/files.js +0 -44
- package/dist/builtins/res/files.js.map +1 -1
- package/dist/builtins/res/gather.d.ts +0 -13
- package/dist/builtins/res/gather.facts.js +24 -16
- package/dist/builtins/res/gather.facts.js.map +1 -1
- package/dist/builtins/res/gather.js +47 -36
- package/dist/builtins/res/gather.js.map +1 -1
- package/dist/builtins/res/gather.process.js +49 -15
- package/dist/builtins/res/gather.process.js.map +1 -1
- package/dist/builtins/res/gather.store.d.ts +4 -2
- package/dist/builtins/res/gather.store.js +43 -31
- package/dist/builtins/res/gather.store.js.map +1 -1
- package/dist/builtins/res/group.d.ts +0 -13
- package/dist/builtins/res/group.js +78 -40
- package/dist/builtins/res/group.js.map +1 -1
- package/dist/builtins/res/image.d.ts +0 -13
- package/dist/builtins/res/image.js +0 -15
- package/dist/builtins/res/image.js.map +1 -1
- package/dist/builtins/res/manifestRead.d.ts +65 -0
- package/dist/builtins/res/manifestRead.js +161 -0
- package/dist/builtins/res/manifestRead.js.map +1 -0
- package/dist/builtins/res/pipeline.d.ts +1 -1
- package/dist/builtins/res/pipeline.js +152 -103
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/pipeline.manifest.js +17 -7
- package/dist/builtins/res/pipeline.manifest.js.map +1 -1
- package/dist/builtins/res/play.d.ts +0 -13
- package/dist/builtins/res/play.js +367 -226
- package/dist/builtins/res/play.js.map +1 -1
- package/dist/builtins/res/plugin.d.ts +1 -13
- package/dist/builtins/res/plugin.info.js +36 -14
- package/dist/builtins/res/plugin.info.js.map +1 -1
- package/dist/builtins/res/plugin.js +1 -17
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugin.sync.d.ts +3 -5
- package/dist/builtins/res/plugin.sync.js +175 -40
- package/dist/builtins/res/plugin.sync.js.map +1 -1
- package/dist/builtins/res/plugininstance.d.ts +0 -13
- package/dist/builtins/res/plugininstance.js +0 -16
- package/dist/builtins/res/plugininstance.js.map +1 -1
- package/dist/builtins/res/pluginmeta.d.ts +0 -13
- package/dist/builtins/res/pluginmeta.js +0 -16
- package/dist/builtins/res/pluginmeta.js.map +1 -1
- package/dist/builtins/res/record.d.ts +0 -13
- package/dist/builtins/res/record.js +2 -18
- package/dist/builtins/res/record.js.map +1 -1
- package/dist/builtins/res/runWait.js +32 -8
- package/dist/builtins/res/runWait.js.map +1 -1
- package/dist/builtins/res/tag.d.ts +0 -13
- package/dist/builtins/res/tag.js +0 -16
- package/dist/builtins/res/tag.js.map +1 -1
- package/dist/builtins/res/thumbnail.js +23 -8
- package/dist/builtins/res/thumbnail.js.map +1 -1
- package/dist/builtins/res/user.d.ts +0 -12
- package/dist/builtins/res/user.js +0 -17
- package/dist/builtins/res/user.js.map +1 -1
- package/dist/builtins/res/workflow.d.ts +0 -13
- package/dist/builtins/res/workflow.js +0 -16
- package/dist/builtins/res/workflow.js.map +1 -1
- package/dist/builtins/runEcho.js +2 -1
- package/dist/builtins/runEcho.js.map +1 -1
- package/dist/builtins/store.d.ts +0 -13
- package/dist/builtins/store.js +32 -32
- package/dist/builtins/store.js.map +1 -1
- package/dist/builtins/sys/apropos.d.ts +2 -27
- package/dist/builtins/sys/apropos.js +2 -32
- package/dist/builtins/sys/apropos.js.map +1 -1
- package/dist/builtins/sys/cal.d.ts +0 -12
- package/dist/builtins/sys/cal.js +0 -15
- package/dist/builtins/sys/cal.js.map +1 -1
- package/dist/builtins/sys/command.js +3 -7
- package/dist/builtins/sys/command.js.map +1 -1
- package/dist/builtins/sys/context.d.ts +0 -8
- package/dist/builtins/sys/context.js +1 -12
- package/dist/builtins/sys/context.js.map +1 -1
- package/dist/builtins/sys/date.d.ts +0 -12
- package/dist/builtins/sys/date.js +0 -15
- package/dist/builtins/sys/date.js.map +1 -1
- package/dist/builtins/sys/echo.d.ts +0 -12
- package/dist/builtins/sys/echo.js +54 -49
- package/dist/builtins/sys/echo.js.map +1 -1
- package/dist/builtins/sys/fortune.d.ts +0 -12
- package/dist/builtins/sys/fortune.js +0 -15
- package/dist/builtins/sys/fortune.js.map +1 -1
- package/dist/builtins/sys/grep.d.ts +14 -18
- package/dist/builtins/sys/grep.js +239 -114
- package/dist/builtins/sys/grep.js.map +1 -1
- package/dist/builtins/sys/hostGrants.d.ts +85 -0
- package/dist/builtins/sys/hostGrants.js +207 -0
- package/dist/builtins/sys/hostGrants.js.map +1 -0
- package/dist/builtins/sys/joblets.d.ts +0 -24
- package/dist/builtins/sys/joblets.js +0 -29
- package/dist/builtins/sys/joblets.js.map +1 -1
- package/dist/builtins/sys/motd.d.ts +0 -12
- package/dist/builtins/sys/motd.js +14 -21
- package/dist/builtins/sys/motd.js.map +1 -1
- package/dist/builtins/sys/notes.js +26 -16
- package/dist/builtins/sys/notes.js.map +1 -1
- package/dist/builtins/sys/physicalmode.d.ts +0 -8
- package/dist/builtins/sys/physicalmode.js +1 -12
- package/dist/builtins/sys/physicalmode.js.map +1 -1
- package/dist/builtins/sys/tasks.d.ts +0 -24
- package/dist/builtins/sys/tasks.js +30 -36
- package/dist/builtins/sys/tasks.js.map +1 -1
- package/dist/builtins/sys/textFilters.d.ts +0 -84
- package/dist/builtins/sys/textFilters.js +33 -110
- package/dist/builtins/sys/textFilters.js.map +1 -1
- package/dist/builtins/sys/timing.d.ts +0 -8
- package/dist/builtins/sys/timing.js +1 -12
- package/dist/builtins/sys/timing.js.map +1 -1
- package/dist/builtins/sys/variables.d.ts +0 -24
- package/dist/builtins/sys/variables.js +0 -29
- package/dist/builtins/sys/variables.js.map +1 -1
- package/dist/builtins/sys/version.d.ts +0 -12
- package/dist/builtins/sys/version.js +0 -15
- package/dist/builtins/sys/version.js.map +1 -1
- package/dist/builtins/sys/weather.js +46 -27
- package/dist/builtins/sys/weather.js.map +1 -1
- package/dist/builtins/sys/whoami.d.ts +0 -22
- package/dist/builtins/sys/whoami.js +16 -43
- package/dist/builtins/sys/whoami.js.map +1 -1
- package/dist/builtins/utils.d.ts +4 -39
- package/dist/builtins/utils.js +24 -55
- package/dist/builtins/utils.js.map +1 -1
- package/dist/chris/backend.js +7 -12
- package/dist/chris/backend.js.map +1 -1
- package/dist/chris/binDeclarations.d.ts +0 -44
- package/dist/chris/binDeclarations.js +111 -29
- package/dist/chris/binDeclarations.js.map +1 -1
- package/dist/chris/binExecutables.js +26 -18
- package/dist/chris/binExecutables.js.map +1 -1
- package/dist/chris/chiliDelegate.d.ts +104 -0
- package/dist/chris/chiliDelegate.js +240 -0
- package/dist/chris/chiliDelegate.js.map +1 -1
- package/dist/chris/commandFallback.d.ts +2 -2
- package/dist/chris/commandFallback.js +107 -50
- package/dist/chris/commandFallback.js.map +1 -1
- package/dist/chris/completion.d.ts +3 -1
- package/dist/chris/completion.js +5 -17
- package/dist/chris/completion.js.map +1 -1
- package/dist/chris/connect.d.ts +37 -0
- package/dist/chris/connect.js +46 -0
- package/dist/chris/connect.js.map +1 -1
- package/dist/chris/files.js +32 -2
- package/dist/chris/files.js.map +1 -1
- package/dist/chris/navigation.js +87 -53
- package/dist/chris/navigation.js.map +1 -1
- package/dist/chris/pacsResources.js +28 -11
- package/dist/chris/pacsResources.js.map +1 -1
- package/dist/chris/promptContext.js +68 -35
- package/dist/chris/promptContext.js.map +1 -1
- package/dist/chris/universeLayout.d.ts +8 -2
- package/dist/chris/universeLayout.js +40 -11
- package/dist/chris/universeLayout.js.map +1 -1
- package/dist/chris/warmup.d.ts +140 -0
- package/dist/chris/warmup.js +622 -0
- package/dist/chris/warmup.js.map +1 -0
- package/dist/core/argumentKinds.js +4 -4
- package/dist/core/argumentKinds.js.map +1 -1
- package/dist/core/assignment.js +8 -6
- package/dist/core/assignment.js.map +1 -1
- package/dist/core/backend.d.ts +44 -8
- package/dist/core/backend.js.map +1 -1
- package/dist/core/commandDeclaration.d.ts +8 -0
- package/dist/core/commandDeclaration.js.map +1 -1
- package/dist/core/commandParse.d.ts +34 -1
- package/dist/core/commandParse.js +156 -28
- package/dist/core/commandParse.js.map +1 -1
- package/dist/core/commandRegistry.d.ts +24 -5
- package/dist/core/commandRegistry.js +28 -5
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/dispatch.d.ts +1 -12
- package/dist/core/dispatch.js +12 -16
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/elevation.js +30 -5
- package/dist/core/elevation.js.map +1 -1
- package/dist/core/engine.d.ts +5 -11
- package/dist/core/engine.js +126 -50
- package/dist/core/engine.js.map +1 -1
- package/dist/core/expansion.d.ts +0 -6
- package/dist/core/expansion.js +0 -8
- package/dist/core/expansion.js.map +1 -1
- package/dist/core/filesystem.js +1 -1
- package/dist/core/filesystem.js.map +1 -1
- package/dist/core/handlerRun.d.ts +13 -0
- package/dist/core/handlerRun.js +21 -0
- package/dist/core/handlerRun.js.map +1 -1
- package/dist/core/holds.js +3 -3
- package/dist/core/holds.js.map +1 -1
- package/dist/core/hostGate.d.ts +62 -0
- package/dist/core/hostGate.js +72 -0
- package/dist/core/hostGate.js.map +1 -0
- package/dist/core/joblets.js +53 -27
- package/dist/core/joblets.js.map +1 -1
- package/dist/core/paths.d.ts +3 -5
- package/dist/core/paths.js +107 -36
- package/dist/core/paths.js.map +1 -1
- package/dist/core/preprocess.d.ts +12 -0
- package/dist/core/preprocess.js +42 -15
- package/dist/core/preprocess.js.map +1 -1
- package/dist/core/question.d.ts +27 -3
- package/dist/core/question.js +14 -6
- package/dist/core/question.js.map +1 -1
- package/dist/core/runner.d.ts +31 -7
- package/dist/core/runner.js +189 -37
- package/dist/core/runner.js.map +1 -1
- package/dist/core/sink.d.ts +7 -19
- package/dist/core/sink.js +56 -28
- package/dist/core/sink.js.map +1 -1
- package/dist/core/surface.js +1 -0
- package/dist/core/surface.js.map +1 -1
- package/dist/core/variables.js +37 -11
- package/dist/core/variables.js.map +1 -1
- package/dist/core/version.d.ts +0 -20
- package/dist/core/version.js +2 -26
- package/dist/core/version.js.map +1 -1
- package/dist/core/warmupFailures.d.ts +3 -6
- package/dist/core/warmupFailures.js.map +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.js +2 -0
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/completer/cfsPaths.js +66 -26
- package/dist/lib/completer/cfsPaths.js.map +1 -1
- package/dist/lib/completer/declared.js +81 -20
- package/dist/lib/completer/declared.js.map +1 -1
- package/dist/lib/completer/index.d.ts +3 -0
- package/dist/lib/completer/index.js +44 -7
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/lib/parser.d.ts +0 -16
- package/dist/lib/parser.js +223 -135
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/vfs/folderListing.d.ts +85 -0
- package/dist/lib/vfs/folderListing.js +86 -0
- package/dist/lib/vfs/folderListing.js.map +1 -0
- package/dist/lib/vfs/vfs.d.ts +37 -9
- package/dist/lib/vfs/vfs.js +195 -110
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/dist/lib/wildcard.d.ts +7 -34
- package/dist/lib/wildcard.js +123 -95
- package/dist/lib/wildcard.js.map +1 -1
- package/dist/notes.json +1 -1
- package/dist/session/answerAdapters.js +249 -131
- package/dist/session/answerAdapters.js.map +1 -1
- package/package.json +12 -10
- package/dist/builtins/wildcard.d.ts +0 -8
- package/dist/builtins/wildcard.js +0 -9
- package/dist/builtins/wildcard.js.map +0 -1
- package/dist/lib/quoting.d.ts +0 -40
- package/dist/lib/quoting.js +0 -70
- package/dist/lib/quoting.js.map +0 -1
- package/dist/lib/semicolonParser.d.ts +0 -41
- package/dist/lib/semicolonParser.js +0 -93
- package/dist/lib/semicolonParser.js.map +0 -1
package/dist/api/models.d.ts
CHANGED
|
@@ -24,12 +24,11 @@ import type { CpModelData } from '../builtins/fs/cp.js';
|
|
|
24
24
|
import type { MvModelData } from '../builtins/fs/mv.js';
|
|
25
25
|
/**
|
|
26
26
|
* The payload the `fs.cwd` kind carries.
|
|
27
|
-
*
|
|
28
|
-
* @property path - The current working directory.
|
|
29
|
-
* @property shown - The display form (titles substituted), when produced.
|
|
30
27
|
*/
|
|
31
28
|
export interface CwdModel {
|
|
29
|
+
/** The current working directory. */
|
|
32
30
|
path: string;
|
|
31
|
+
/** The display form (titles substituted), when produced. */
|
|
33
32
|
shown?: string;
|
|
34
33
|
}
|
|
35
34
|
/**
|
package/dist/api/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/api/models.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/api/models.ts"],"names":[],"mappings":"AAuKA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAsB,QAAyB;IAC3E,OAAO,QAA4B,CAAC;AACtC,CAAC"}
|
package/dist/buildinfo.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"hash":"
|
|
1
|
+
{"hash":"b4bb22"}
|
|
@@ -30,6 +30,29 @@ export function argumentValue_coerce(value) {
|
|
|
30
30
|
}
|
|
31
31
|
return value;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Extracts the stripped option string from a prefixed flag or bare assignment token.
|
|
35
|
+
*
|
|
36
|
+
* @param token - A single argument token.
|
|
37
|
+
* @returns The option body with leading dashes removed.
|
|
38
|
+
* @throws {Error} When the token is neither a prefixed option nor a `key=value` assignment.
|
|
39
|
+
*/
|
|
40
|
+
function optionBody_extract(token) {
|
|
41
|
+
const prefixed = token.startsWith('-') && token !== '-';
|
|
42
|
+
const bareAssignment = !prefixed && token.indexOf('=') > 0;
|
|
43
|
+
if (!prefixed && !bareAssignment)
|
|
44
|
+
throw new Error(`Unexpected value without an option: ${token}`);
|
|
45
|
+
return prefixed ? token.replace(/^-+/, '') : token;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks whether the token following a flag is its value rather than another flag.
|
|
49
|
+
*
|
|
50
|
+
* @param next - The next token, if any.
|
|
51
|
+
* @returns True when `next` should be consumed as the option's value.
|
|
52
|
+
*/
|
|
53
|
+
function optionValue_follows(next) {
|
|
54
|
+
return next !== undefined && (!next.startsWith('-') || /^-\d/.test(next));
|
|
55
|
+
}
|
|
33
56
|
/**
|
|
34
57
|
* Parse already-tokenized options and context assignments.
|
|
35
58
|
*
|
|
@@ -41,11 +64,7 @@ export function executableArguments_parse(tokens) {
|
|
|
41
64
|
const result = {};
|
|
42
65
|
for (let index = 0; index < tokens.length; index++) {
|
|
43
66
|
const token = tokens[index];
|
|
44
|
-
const
|
|
45
|
-
const bareAssignment = !prefixed && token.indexOf('=') > 0;
|
|
46
|
-
if (!prefixed && !bareAssignment)
|
|
47
|
-
throw new Error(`Unexpected value without an option: ${token}`);
|
|
48
|
-
const option = prefixed ? token.replace(/^-+/, '') : token;
|
|
67
|
+
const option = optionBody_extract(token);
|
|
49
68
|
const equalsIndex = option.indexOf('=');
|
|
50
69
|
if (equalsIndex >= 0) {
|
|
51
70
|
const name = option.slice(0, equalsIndex);
|
|
@@ -57,7 +76,7 @@ export function executableArguments_parse(tokens) {
|
|
|
57
76
|
if (!option)
|
|
58
77
|
throw new Error(`Invalid option: ${token}`);
|
|
59
78
|
const next = tokens[index + 1];
|
|
60
|
-
if (
|
|
79
|
+
if (optionValue_follows(next)) {
|
|
61
80
|
result[option] = argumentValue_coerce(next);
|
|
62
81
|
index++;
|
|
63
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argumentTokens.js","sourceRoot":"","sources":["../../src/builtins/argumentTokens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACxB,MAAM,OAAO,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;YAAE,OAAO,OAAO,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"argumentTokens.js","sourceRoot":"","sources":["../../src/builtins/argumentTokens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAClC,IAAI,KAAK,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACxB,MAAM,OAAO,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;YAAE,OAAO,OAAO,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,KAAa;IACvC,MAAM,QAAQ,GAAY,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,GAAG,CAAC;IACjE,MAAM,cAAc,GAAY,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc;QAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,KAAK,EAAE,CAAC,CAAC;IAClG,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,IAAwB;IACnD,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAyB;IACjE,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3D,MAAM,KAAK,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,MAAM,GAAW,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACjD,MAAM,WAAW,GAAW,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;YAClD,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC;YACvD,MAAM,CAAC,IAAI,CAAC,GAAG,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC;YACnE,SAAS;QACX,CAAC;QACD,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC;QACzD,MAAM,IAAI,GAAuB,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACnD,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;YAC5C,KAAK,EAAE,CAAC;QACV,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
2
1
|
/** The size above which an anchor asks before it downloads: 10 GB. */
|
|
3
2
|
export declare const ANCHOR_ASK_BYTES: number;
|
|
4
3
|
/**
|
|
@@ -101,16 +100,3 @@ export declare const berthCommand: import("../../core/commandDeclaration.js").Co
|
|
|
101
100
|
};
|
|
102
101
|
};
|
|
103
102
|
}>;
|
|
104
|
-
/**
|
|
105
|
-
* `berth` over words already split: the declaration's parse and handler.
|
|
106
|
-
*
|
|
107
|
-
* @param args - The words after `berth`.
|
|
108
|
-
* @returns The answer, or a refusal in POSIX tone.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```ts
|
|
112
|
-
* await builtin_berth(['anchor', '~/uploads/weights', 'w']);
|
|
113
|
-
* await builtin_berth([]); // the anchors
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
export declare function builtin_berth(args: string[]): Promise<CommandEnvelope>;
|
|
@@ -23,14 +23,13 @@
|
|
|
23
23
|
*
|
|
24
24
|
* Key components:
|
|
25
25
|
* - berthCommand: the declaration: the verb and its subcommands.
|
|
26
|
-
* - builtin_berth: the declaration run over words already split.
|
|
27
26
|
* - ANCHOR_ASK_BYTES: the size above which an anchor asks first.
|
|
28
27
|
*
|
|
29
28
|
* Typical usage:
|
|
30
29
|
* ```ts
|
|
31
|
-
* await
|
|
32
|
-
* await
|
|
33
|
-
* await
|
|
30
|
+
* await declaredCommand_run(berthCommand, ['anchor', '~/feeds/feed_5/pl-fshack_41/data/sub-01']);
|
|
31
|
+
* await declaredCommand_run(berthCommand, []);
|
|
32
|
+
* await declaredCommand_run(berthCommand, ['drop', 'sub-01']);
|
|
34
33
|
* ```
|
|
35
34
|
*
|
|
36
35
|
* Dependencies: the berth's places from the environment (berthState.ts);
|
|
@@ -38,23 +37,22 @@
|
|
|
38
37
|
*
|
|
39
38
|
* @module
|
|
40
39
|
*/
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import { pipeline } from 'node:stream/promises';
|
|
40
|
+
import { existsSync, lstatSync, readdirSync, renameSync, rmSync } from 'node:fs';
|
|
41
|
+
import { join, posix } from 'node:path';
|
|
44
42
|
import chalk from 'chalk';
|
|
45
43
|
import { transferPool_run } from '@fnndsc/cumin/transfer-pool';
|
|
46
|
-
import { size_format } from '@fnndsc/fond';
|
|
47
|
-
import { envelope_error, envelope_ok } from '@fnndsc/menu';
|
|
44
|
+
import { operatorFolder_place, publication_isUnconfirmed, placedFile_write, placedFolder_make, placed_child, placed_parent, size_format } from '@fnndsc/fond';
|
|
45
|
+
import { envelope_error, envelope_ok, feedId_parse } from '@fnndsc/menu';
|
|
48
46
|
import { command_declare } from '../../core/commandDeclaration.js';
|
|
49
|
-
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
50
47
|
import { commandUsage_render } from '../../core/commandUsage.js';
|
|
51
48
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
52
49
|
import { commandCancellation_enable, commandCancellation_signalGet } from '../../core/cancellation.js';
|
|
53
50
|
import { TRANSFER_JOBS_OPTION, transferJobs_resolve } from '../fs/transferJobs.js';
|
|
54
51
|
import { repl_confirm } from '../../core/question.js';
|
|
55
52
|
import { sink_dataLine, sink_get } from '../../core/sink.js';
|
|
53
|
+
import { close_run, fileDigest_read, outgoing_walk, WORK_TITLE } from './berthClose.js';
|
|
54
|
+
import { closedRecord_match, digests_agree, errnoCode_get, pathBytes_show } from './berthClosed.js';
|
|
56
55
|
import { berthHome_get, berthPath_resolve, nodeStatus_get, remoteEntry_read, remoteFile_locate, remoteFile_open, remoteFiles_memoRun, remoteTree_list, } from './berthCube.js';
|
|
57
|
-
import { close_run, WORK_TITLE } from './berthClose.js';
|
|
58
56
|
import { freeBytes_get } from './berthDisk.js';
|
|
59
57
|
import { BERTH_STATE_FILE, berthPlaces_read, berthState_read, berthState_update, } from './berthState.js';
|
|
60
58
|
import { anchorNode_show, BerthRefusal, bytes_sum, columns_render, count_say } from './berthWords.js';
|
|
@@ -64,8 +62,6 @@ export const ANCHOR_ASK_BYTES = 10 * 1024 ** 3;
|
|
|
64
62
|
const NODE_FINISHED = 'finishedSuccessfully';
|
|
65
63
|
/** The prefix of the folder an anchor is downloaded into before it takes its name. */
|
|
66
64
|
const PARTIAL_PREFIX = '.partial-';
|
|
67
|
-
/** The write bits a downloaded file loses. */
|
|
68
|
-
const WRITE_BITS = 0o222;
|
|
69
65
|
/**
|
|
70
66
|
* The anchor subcommand's usage line, from the declaration.
|
|
71
67
|
*
|
|
@@ -124,9 +120,9 @@ async function anchorSource_find(resolved, home) {
|
|
|
124
120
|
if (!resolved.startsWith(`${home.replace(/\/$/, '')}/feeds/`)) {
|
|
125
121
|
return { path: resolved, defaultName, node: null, feed: null, nodeName: null };
|
|
126
122
|
}
|
|
127
|
-
const {
|
|
123
|
+
const { path_extractPluginInstanceID } = await import('@fnndsc/cumin');
|
|
128
124
|
const node = path_extractPluginInstanceID(resolved);
|
|
129
|
-
const feed =
|
|
125
|
+
const feed = feedId_parse(resolved);
|
|
130
126
|
if (node === null || feed === null) {
|
|
131
127
|
throw new BerthRefusal(`anchor: ${resolved} is in your feeds but not at a node (…/feeds/feed_N/pl-x_ID)`);
|
|
132
128
|
}
|
|
@@ -153,48 +149,106 @@ async function nodeFinished_check(source) {
|
|
|
153
149
|
}
|
|
154
150
|
}
|
|
155
151
|
/**
|
|
156
|
-
* Writes one ChRIS file to the berth's disk,
|
|
152
|
+
* Writes one ChRIS file to the berth's disk through fond's writer: owner-only and read-only (0400), in its placed
|
|
153
|
+
* folder.
|
|
157
154
|
*
|
|
158
155
|
* @param file - The file to read.
|
|
159
|
-
* @param
|
|
160
|
-
* @param
|
|
156
|
+
* @param placed - Its place.
|
|
157
|
+
* @param tally - Told the bytes as they arrive, and told them back (negative) when the attempt fails.
|
|
161
158
|
* @param signal - The transfer pool's signal: a cancel stops the stream where it is.
|
|
159
|
+
* @returns Null when written; the reason when it was published but not confirmed (not to be retried).
|
|
162
160
|
* @throws {Error} When the file cannot be read or written.
|
|
163
161
|
*/
|
|
164
|
-
async function file_download(file,
|
|
162
|
+
async function file_download(file, placed, tally, signal) {
|
|
165
163
|
let counted = 0;
|
|
166
|
-
const count_add = (count) => { counted += count; bytes_add(count); };
|
|
167
164
|
try {
|
|
168
|
-
|
|
165
|
+
const folder = placed_parent(placed);
|
|
166
|
+
if (folder !== null)
|
|
167
|
+
placedFolder_make(folder);
|
|
169
168
|
const bytes = await remoteFile_open(file.source);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
count_add(bytes.stream.length);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
bytes.stream.on('data', (chunk) => count_add(chunk.length));
|
|
176
|
-
await pipeline(bytes.stream, createWriteStream(target), { signal });
|
|
177
|
-
}
|
|
178
|
-
chmodSync(target, statSync(target).mode & ~WRITE_BITS);
|
|
169
|
+
await placedFile_write(placed, bytes.stream, { mode: 0o400, signal, bytes_add: (count) => { counted += count; tally(count); } });
|
|
170
|
+
return null;
|
|
179
171
|
}
|
|
180
172
|
catch (error) {
|
|
173
|
+
// Published but not confirmed: never tried again; the anchor fails with it, and its staging folder goes.
|
|
174
|
+
if (publication_isUnconfirmed(error))
|
|
175
|
+
return error instanceof Error ? error.message : String(error);
|
|
181
176
|
// A retry counts its bytes again: the progress takes this attempt's back.
|
|
182
|
-
|
|
177
|
+
tally(-counted);
|
|
183
178
|
throw error;
|
|
184
179
|
}
|
|
185
180
|
}
|
|
186
181
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
182
|
+
* Clears the berth's own staging folder for an anchor (`.partial-<name>` under its anchors): what a download left,
|
|
183
|
+
* or what a refused plan or a failed download made.
|
|
184
|
+
*
|
|
185
|
+
* @param partial - The staging folder.
|
|
186
|
+
*/
|
|
187
|
+
function stagingFolder_clear(partial) {
|
|
188
|
+
rmSync(partial, { recursive: true, force: true });
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Where each file is written under a folder, every one of them inside it.
|
|
192
|
+
*
|
|
193
|
+
* The names come from a listing ChRIS made. The folder is the berth's own (its staging folder, under its anchors)
|
|
194
|
+
* and each name is placed under it by fond, which refuses a name that would leave it; one such name refuses them
|
|
195
|
+
* all, before anything is written or removed.
|
|
196
|
+
*
|
|
197
|
+
* @param files - The files.
|
|
198
|
+
* @param folder - The folder they are written under (made when missing).
|
|
199
|
+
* @returns Each file's place, by its relative name.
|
|
200
|
+
* @throws {Error} Naming every file that has no place inside the folder.
|
|
201
|
+
*/
|
|
202
|
+
function filePlaces_plan(files, folder) {
|
|
203
|
+
// The staging folder is made (even for no files: an empty anchor is still an anchor), then held by its own
|
|
204
|
+
// identity before any listed name is placed under it.
|
|
205
|
+
const made = operatorFolder_place(folder, true);
|
|
206
|
+
if (!made.ok)
|
|
207
|
+
throw new Error(made.reason);
|
|
208
|
+
placedFolder_make(made.placed);
|
|
209
|
+
const root = operatorFolder_place(folder, false);
|
|
210
|
+
if (!root.ok)
|
|
211
|
+
throw new Error(root.reason);
|
|
212
|
+
const places = new Map();
|
|
213
|
+
// Each file's place, and the folders on its way: a file where another file's folder is, or the reverse, clashes.
|
|
214
|
+
const filesAt = new Set();
|
|
215
|
+
const foldersAt = new Set();
|
|
216
|
+
const refused = [];
|
|
217
|
+
for (const file of files) {
|
|
218
|
+
const placed = placed_child(root.placed, file.name);
|
|
219
|
+
if (!placed.ok) {
|
|
220
|
+
refused.push(placed.reason);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const place = placed.placed.place;
|
|
224
|
+
const above = [];
|
|
225
|
+
for (let at = place.slice(0, place.lastIndexOf('/')); at.length > root.placed.place.length; at = at.slice(0, at.lastIndexOf('/')))
|
|
226
|
+
above.push(at);
|
|
227
|
+
if (filesAt.has(place) || foldersAt.has(place) || above.some((at) => filesAt.has(at))) {
|
|
228
|
+
refused.push(`${JSON.stringify(file.name)}: another file of this anchor already stands at or around ${JSON.stringify(place)}`);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
filesAt.add(place);
|
|
232
|
+
for (const at of above)
|
|
233
|
+
foldersAt.add(at);
|
|
234
|
+
places.set(file.name, placed.placed);
|
|
235
|
+
}
|
|
236
|
+
if (refused.length > 0) {
|
|
237
|
+
throw new Error(`${count_say(refused.length, 'file')} of ${files.length} cannot be placed: ${refused.join('; ')}`);
|
|
238
|
+
}
|
|
239
|
+
return places;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Downloads files into their places through the transfer pool, saying the bytes as they arrive across every file
|
|
243
|
+
* in flight.
|
|
189
244
|
*
|
|
190
245
|
* @param files - The files.
|
|
191
|
-
* @param
|
|
246
|
+
* @param places - Each file's place, by its relative name.
|
|
192
247
|
* @param label - The anchor's name, for the progress.
|
|
193
248
|
* @param jobs - How many files move at once.
|
|
194
249
|
* @throws {Error} Naming each file that failed after its retry, or saying the line was cancelled.
|
|
195
250
|
*/
|
|
196
|
-
async function files_download(files,
|
|
197
|
-
mkdirSync(folder, { recursive: true });
|
|
251
|
+
async function files_download(files, places, label, jobs) {
|
|
198
252
|
const total = bytes_sum(files);
|
|
199
253
|
let current = 0;
|
|
200
254
|
const progress = (phase) => sink_get().progress_write({
|
|
@@ -203,13 +257,15 @@ async function files_download(files, folder, label, jobs) {
|
|
|
203
257
|
});
|
|
204
258
|
commandCancellation_enable();
|
|
205
259
|
const signal = commandCancellation_signalGet();
|
|
206
|
-
const result = await remoteFiles_memoRun(() => transferPool_run(files, (file, poolSignal) => file_download(file,
|
|
260
|
+
const result = await remoteFiles_memoRun(() => transferPool_run(files, (file, poolSignal) => file_download(file, places.get(file.name), (count) => { current += count; progress('transferring'); }, poolSignal), { jobs, ...(signal !== undefined ? { signal } : {}) }));
|
|
207
261
|
if (result.cancelled.length > 0) {
|
|
208
262
|
throw new Error(`cancelled with ${count_say(result.cancelled.length, 'file')} not downloaded`);
|
|
209
263
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
264
|
+
// A publication that could not be confirmed fails the anchor like a failed file, but was never tried twice.
|
|
265
|
+
const unconfirmed = result.done.filter((done) => done.value !== null).map((done) => `${done.item.name} (${String(done.value)})`);
|
|
266
|
+
if (result.failed.length > 0 || unconfirmed.length > 0) {
|
|
267
|
+
const named = [...result.failed.map((failure) => `${failure.item.name} (${failure.reason})`), ...unconfirmed].join(', ');
|
|
268
|
+
throw new Error(`${count_say(result.failed.length + unconfirmed.length, 'file')} of ${files.length} failed: ${named}`);
|
|
213
269
|
}
|
|
214
270
|
progress('complete');
|
|
215
271
|
}
|
|
@@ -303,17 +359,29 @@ async function anchor_run(request) {
|
|
|
303
359
|
}
|
|
304
360
|
const final = join(places.anchors, name);
|
|
305
361
|
const partial = join(places.anchors, `${PARTIAL_PREFIX}${name}`);
|
|
362
|
+
// What a download left behind is cleared first, and every name is placed
|
|
363
|
+
// before the anchor that stands is let go: a listing with a name that
|
|
364
|
+
// cannot be placed refuses the refresh with the old copy still there.
|
|
365
|
+
stagingFolder_clear(partial);
|
|
366
|
+
let filePlaces;
|
|
367
|
+
try {
|
|
368
|
+
filePlaces = filePlaces_plan(files, partial);
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
// The staging folder the plan made is the berth's own: it goes with the refused plan.
|
|
372
|
+
stagingFolder_clear(partial);
|
|
373
|
+
throw new BerthRefusal(`anchor: ${name}: ${error instanceof Error ? error.message : String(error)}; nothing anchored${standing !== null ? ', and the anchor that stands is kept' : ''}`);
|
|
374
|
+
}
|
|
306
375
|
if (standing !== null) {
|
|
307
376
|
// A refresh lets the old copy go first, as drop does: ChRIS still holds it.
|
|
308
377
|
rmSync(final, { recursive: true, force: true });
|
|
309
378
|
berthState_update(places.anchors, (state) => ({ ...state, anchors: state.anchors.filter((anchor) => anchor.name !== name) }));
|
|
310
379
|
}
|
|
311
|
-
rmSync(partial, { recursive: true, force: true });
|
|
312
380
|
try {
|
|
313
|
-
await files_download(files,
|
|
381
|
+
await files_download(files, filePlaces, name, jobs.jobs);
|
|
314
382
|
}
|
|
315
383
|
catch (error) {
|
|
316
|
-
|
|
384
|
+
stagingFolder_clear(partial);
|
|
317
385
|
throw new BerthRefusal(`anchor: ${name}: ${error instanceof Error ? error.message : String(error)}; nothing anchored`);
|
|
318
386
|
}
|
|
319
387
|
renameSync(partial, final);
|
|
@@ -383,50 +451,151 @@ function drop_run(name) {
|
|
|
383
451
|
return envelope_ok(`${chalk.gray(`dropped ${name}; ChRIS still holds ${anchor.path}`)}\n`);
|
|
384
452
|
}
|
|
385
453
|
/**
|
|
386
|
-
*
|
|
454
|
+
* What a clear judges: each entry of the outgoing folder closed when the
|
|
455
|
+
* last close returned it with the size and hash it has now; every other
|
|
456
|
+
* entry not, and every entry not when the state's list cannot be read.
|
|
387
457
|
*
|
|
388
|
-
* @param
|
|
389
|
-
* @param
|
|
390
|
-
* @returns
|
|
458
|
+
* @param outgoing - The outgoing folder.
|
|
459
|
+
* @param closed - The files the last close returned; null when the state's list cannot be read.
|
|
460
|
+
* @returns The judgement.
|
|
391
461
|
*/
|
|
392
|
-
function
|
|
393
|
-
const
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
462
|
+
async function outgoing_judge(outgoing, closed) {
|
|
463
|
+
const recorded = closed === null ? null : new Map(closed.map((file) => [file.name, file]));
|
|
464
|
+
const walked = outgoing_walk(outgoing);
|
|
465
|
+
const closedEntries = [];
|
|
466
|
+
const unclosed = [];
|
|
467
|
+
const kept = walked.entries.filter((entry) => entry.kind === 'folder');
|
|
468
|
+
for (const entry of walked.entries) {
|
|
469
|
+
if (entry.kind === 'folder')
|
|
397
470
|
continue;
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
changed.push(path);
|
|
471
|
+
const record = closedRecord_match(entry, recorded);
|
|
472
|
+
const digest = record === null ? null : await fileDigest_read(entry.path);
|
|
473
|
+
(record !== null && digest !== null && digests_agree(record, { name: record.name, ...digest }) ? closedEntries : unclosed).push(entry);
|
|
402
474
|
}
|
|
403
|
-
return
|
|
475
|
+
return { closed: closedEntries, unclosed, folders: walked.folders, kept };
|
|
404
476
|
}
|
|
405
477
|
/**
|
|
406
|
-
*
|
|
407
|
-
* are mounts, which the session does not remove.
|
|
478
|
+
* One path and why it could not be removed, in words.
|
|
408
479
|
*
|
|
409
|
-
* @param
|
|
480
|
+
* @param path - The path.
|
|
481
|
+
* @param error - What the removal threw.
|
|
482
|
+
* @returns The words.
|
|
410
483
|
*/
|
|
411
|
-
function
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
484
|
+
function removalRefused_say(path, error) {
|
|
485
|
+
return `${pathBytes_show(path)} (${errnoCode_get(error) ?? String(error)})`;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Empties the outgoing folder of what a clear judged: each entry it walked,
|
|
489
|
+
* one by one and never a folder's whole tree, then each folder it walked
|
|
490
|
+
* into that is empty by then. An entry that came after the walk stays, and
|
|
491
|
+
* so does the folder that holds it; a folder the walk could not look inside
|
|
492
|
+
* is never among them; the outgoing folder itself stays, since a berth's
|
|
493
|
+
* places are mounts. An entry or a folder that cannot be removed is kept
|
|
494
|
+
* and said, and the rest go on.
|
|
495
|
+
*
|
|
496
|
+
* @param entries - The entries judged: none of them a folder.
|
|
497
|
+
* @param folders - The folders walked into, each after the folders inside it.
|
|
498
|
+
* @returns What could not be removed.
|
|
499
|
+
*/
|
|
500
|
+
function folder_empty(entries, folders) {
|
|
501
|
+
const walkedFolders = new Set(folders);
|
|
502
|
+
const failed = [];
|
|
503
|
+
const said = [];
|
|
504
|
+
const byPath = new Map(entries.map((entry) => [entry.path, entry]));
|
|
505
|
+
for (const path of [...entries.map((entry) => entry.path), ...folders]) {
|
|
506
|
+
const folder = walkedFolders.has(path);
|
|
507
|
+
try {
|
|
508
|
+
// A folder that holds anything (what came while clear ran, or what it could not remove) stays.
|
|
509
|
+
if (folder && readdirSync(path).length > 0)
|
|
510
|
+
continue;
|
|
511
|
+
// A link (to a folder too) goes as a link, which a removal without `recursive` refuses for a folder's link.
|
|
512
|
+
const link = !folder && lstatSync(path, { throwIfNoEntry: false })?.isSymbolicLink() === true;
|
|
513
|
+
// A folder found empty, a link, or one entry that is not a folder: never a tree.
|
|
514
|
+
rmSync(path, { recursive: folder || link, force: true });
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
if (folder && errnoCode_get(error) === 'ENOENT')
|
|
518
|
+
continue;
|
|
519
|
+
said.push(removalRefused_say(path, error));
|
|
520
|
+
const entry = byPath.get(path);
|
|
521
|
+
if (entry !== undefined)
|
|
522
|
+
failed.push(entry);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
return { entries: failed, said };
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* The closed files a clear leaves recorded while it removes: every record
|
|
529
|
+
* of an entry it is about to remove is retired first, so a removal that
|
|
530
|
+
* stops part way never leaves a record of a file already gone.
|
|
531
|
+
*
|
|
532
|
+
* @param closed - The files recorded closed; null when the list cannot be read.
|
|
533
|
+
* @param judged - The entries the clear is about to remove.
|
|
534
|
+
* @returns The files still recorded.
|
|
535
|
+
*/
|
|
536
|
+
function closedJudged_retire(closed, judged) {
|
|
537
|
+
const removing = new Set(judged.flatMap((entry) => (entry.name === null ? [] : [entry.name])));
|
|
538
|
+
return closed === null ? null : closed.filter((file) => !removing.has(file.name));
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* The closed files a clear leaves recorded once it has removed: the
|
|
542
|
+
* records retired for entries it could not remove come back, since such a
|
|
543
|
+
* file is still the one the close returned; none at all when everything went.
|
|
544
|
+
*
|
|
545
|
+
* @param now - The files recorded closed now.
|
|
546
|
+
* @param before - The files recorded closed before the clear.
|
|
547
|
+
* @param failed - The entries it could not remove.
|
|
548
|
+
* @param whole - Whether the clear removed everything it judged and kept no folder.
|
|
549
|
+
* @returns The files recorded.
|
|
550
|
+
*/
|
|
551
|
+
function closedFailed_restore(now, before, failed, whole) {
|
|
552
|
+
if (whole)
|
|
553
|
+
return [];
|
|
554
|
+
const standing = new Set(failed.flatMap((entry) => (entry.name === null ? [] : [entry.name])));
|
|
555
|
+
const restored = (before ?? []).filter((file) => standing.has(file.name));
|
|
556
|
+
return now === null ? null : [...now, ...restored];
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* What stands in the outgoing folder after a clear, in words.
|
|
560
|
+
*
|
|
561
|
+
* @param outgoing - The outgoing folder.
|
|
562
|
+
* @param kept - The entries the clear kept: folders it could not look inside, and what it could not remove.
|
|
563
|
+
* @returns The words after `cleared N anchors`.
|
|
564
|
+
*/
|
|
565
|
+
function outgoingAfter_say(outgoing, kept) {
|
|
566
|
+
// `kept` counts every entry clear kept on purpose or could not remove; only with none did the rest come while it ran.
|
|
567
|
+
let staying;
|
|
568
|
+
try {
|
|
569
|
+
staying = readdirSync(outgoing).length;
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
if (errnoCode_get(error) !== 'ENOENT')
|
|
573
|
+
return `; ${outgoing} cannot be read after the clear (${errnoCode_get(error) ?? String(error)})`;
|
|
574
|
+
staying = 0;
|
|
575
|
+
}
|
|
576
|
+
if (staying === 0)
|
|
577
|
+
return ` and emptied ${outgoing}`;
|
|
578
|
+
const came = kept === 0 ? ' that came while clear ran' : '';
|
|
579
|
+
return ` and ${outgoing} keeps ${String(staying)} ${staying === 1 ? 'entry' : 'entries'}${came}`;
|
|
416
580
|
}
|
|
417
581
|
/**
|
|
418
582
|
* `berth clear`: removes every anchor and empties the outgoing folder, asking
|
|
419
|
-
* first only when the outgoing folder holds files not yet closed
|
|
583
|
+
* first only when the outgoing folder holds files not yet closed: any file
|
|
584
|
+
* the last close did not return as it stands now, by name, size and hash
|
|
585
|
+
* (berthClosed.ts). It removes only the entries it judged, then the folders
|
|
586
|
+
* left empty: what comes while it runs stays, and is said.
|
|
420
587
|
*
|
|
421
588
|
* @returns What was removed, or that nothing was.
|
|
422
589
|
*/
|
|
423
590
|
async function clear_run() {
|
|
424
591
|
const places = places_require('clear');
|
|
425
592
|
const state = berthState_read(places.anchors);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
593
|
+
if (state.closed === null) {
|
|
594
|
+
sink_dataLine(`berth: clear: ${places.anchors}/${BERTH_STATE_FILE} holds a list of closed files that cannot be read; every file in ${places.outgoing} counts as not yet closed`);
|
|
595
|
+
}
|
|
596
|
+
const judged = await outgoing_judge(places.outgoing, state.closed);
|
|
597
|
+
if (judged.unclosed.length > 0) {
|
|
598
|
+
const asked = `berth: clear: ${places.outgoing} holds ${count_say(judged.unclosed.length, 'file')} not yet closed; remove them and every anchor?`;
|
|
430
599
|
if (!await repl_confirm(asked)) {
|
|
431
600
|
exitCode_set(1);
|
|
432
601
|
return envelope_ok('berth: clear: nothing removed\n');
|
|
@@ -436,9 +605,22 @@ async function clear_run() {
|
|
|
436
605
|
if (name !== BERTH_STATE_FILE)
|
|
437
606
|
rmSync(join(places.anchors, name), { recursive: true, force: true });
|
|
438
607
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
608
|
+
const removing = [...judged.closed, ...judged.unclosed];
|
|
609
|
+
// A clear consumes the close's receipt for what it removes: the records go before the files do, so a file of the
|
|
610
|
+
// same name and bytes written later is asked about until the next close; a file it could not remove gets its
|
|
611
|
+
// record back.
|
|
612
|
+
berthState_update(places.anchors, (now) => ({ ...now, anchors: [], closed: closedJudged_retire(now.closed, removing) }));
|
|
613
|
+
const failures = folder_empty(removing, judged.folders);
|
|
614
|
+
const whole = failures.said.length === 0 && judged.kept.length === 0;
|
|
615
|
+
berthState_update(places.anchors, (now) => ({ ...now, closed: closedFailed_restore(now.closed, state.closed, failures.entries, whole) }));
|
|
616
|
+
for (const one of failures.said)
|
|
617
|
+
sink_dataLine(`berth: clear: could not remove ${one}`);
|
|
618
|
+
if (failures.said.length > 0)
|
|
619
|
+
exitCode_set(1);
|
|
620
|
+
for (const folder of judged.kept) {
|
|
621
|
+
sink_dataLine(`berth: clear: kept ${pathBytes_show(folder.path)}: a folder clear cannot look inside (${folder.name === null ? 'its name is not UTF-8 text' : 'it cannot be read'}); remove it yourself`);
|
|
622
|
+
}
|
|
623
|
+
return envelope_ok(`${chalk.gray(`cleared ${count_say(state.anchors.length, 'anchor')}${outgoingAfter_say(places.outgoing, judged.kept.length + failures.said.length)}`)}\n`);
|
|
442
624
|
}
|
|
443
625
|
/** What a `berth` line may hold. */
|
|
444
626
|
const BERTH_GRAMMAR = {
|
|
@@ -537,19 +719,4 @@ export const berthCommand = command_declare({
|
|
|
537
719
|
holds: [],
|
|
538
720
|
handler: berth_run,
|
|
539
721
|
});
|
|
540
|
-
/**
|
|
541
|
-
* `berth` over words already split: the declaration's parse and handler.
|
|
542
|
-
*
|
|
543
|
-
* @param args - The words after `berth`.
|
|
544
|
-
* @returns The answer, or a refusal in POSIX tone.
|
|
545
|
-
*
|
|
546
|
-
* @example
|
|
547
|
-
* ```ts
|
|
548
|
-
* await builtin_berth(['anchor', '~/uploads/weights', 'w']);
|
|
549
|
-
* await builtin_berth([]); // the anchors
|
|
550
|
-
* ```
|
|
551
|
-
*/
|
|
552
|
-
export async function builtin_berth(args) {
|
|
553
|
-
return declaredCommand_run(berthCommand, args);
|
|
554
|
-
}
|
|
555
722
|
//# sourceMappingURL=berth.js.map
|