@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/builtins/fs/cp.d.ts
CHANGED
|
@@ -47,14 +47,6 @@ export declare const cpCommand: import("../../core/commandDeclaration.js").Comma
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
}>;
|
|
50
|
-
/**
|
|
51
|
-
* `cp` over words already split: the declaration's parse and handler.
|
|
52
|
-
*
|
|
53
|
-
* @param args - The words after `cp`.
|
|
54
|
-
* @returns An envelope whose rendered text reports progress and results and
|
|
55
|
-
* whose model carries per-source outcomes, or the refusal of a bad line.
|
|
56
|
-
*/
|
|
57
|
-
export declare function builtin_cp(args: string[]): Promise<CommandEnvelope>;
|
|
58
50
|
/** Typed invocation options for cp. */
|
|
59
51
|
export interface CpOptions {
|
|
60
52
|
/** Source paths, absolute or relative to the session cwd. */
|
|
@@ -63,12 +55,16 @@ export interface CpOptions {
|
|
|
63
55
|
dest: string;
|
|
64
56
|
/** Copy directories recursively. */
|
|
65
57
|
recursive?: boolean;
|
|
58
|
+
/** The destination must be one folder (a target directory): anything else refuses the command. Several sources ask it too. */
|
|
59
|
+
intoFolder?: boolean;
|
|
66
60
|
}
|
|
67
61
|
/**
|
|
68
62
|
* Copies files or directories: the shared typed core behind the parsed
|
|
69
|
-
* builtin and the typed API.
|
|
63
|
+
* builtin and the typed API. Several sources, or a target directory, go
|
|
64
|
+
* into one folder, proved once before anything is copied; anything else
|
|
65
|
+
* there refuses the whole command, every source reported not copied.
|
|
70
66
|
*
|
|
71
|
-
* @param options - Sources, destination, and the
|
|
67
|
+
* @param options - Sources, destination, the recursive flag, and whether the destination must be a folder.
|
|
72
68
|
* @returns An envelope whose rendered text reports results and whose
|
|
73
69
|
* `fs.cp` model carries per-source outcomes.
|
|
74
70
|
*/
|
package/dist/builtins/fs/cp.js
CHANGED
|
@@ -11,12 +11,10 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Key components:
|
|
13
13
|
* - cpCommand: the declaration.
|
|
14
|
-
* - builtin_cp: the declaration run over words already split.
|
|
15
14
|
* - cp_run: the typed core behind both, and the typed API.
|
|
16
15
|
*
|
|
17
16
|
* Typical usage:
|
|
18
17
|
* ```ts
|
|
19
|
-
* await builtin_cp(['-r', 'data', 'backup/']);
|
|
20
18
|
* await cp_run({ sources: ['a.txt'], dest: 'b.txt' });
|
|
21
19
|
* ```
|
|
22
20
|
*
|
|
@@ -29,11 +27,9 @@ import chalk from 'chalk';
|
|
|
29
27
|
import path from 'path';
|
|
30
28
|
import { path_resolve, storePath_resolve } from '../utils.js';
|
|
31
29
|
import { command_declare } from '../../core/commandDeclaration.js';
|
|
32
|
-
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
33
30
|
import { listingCache_get, vfsDispatcher_get } from '../../core/filesystem.js';
|
|
34
|
-
import { destination_ask, destination_missing, operands_fix } from './destination.js';
|
|
31
|
+
import { destination_ask, destination_missing, operands_fix, targetFolder_prove } from './destination.js';
|
|
35
32
|
import { cp_render, vfsRefusal_text } from '@fnndsc/fond';
|
|
36
|
-
import { pathEntry_find, entry_isFolder } from './entries.js';
|
|
37
33
|
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
38
34
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
39
35
|
/** What a `cp` line may hold. */
|
|
@@ -61,7 +57,7 @@ async function cp_handle(args) {
|
|
|
61
57
|
// is a source: the shell's own answer to "several things, one destination".
|
|
62
58
|
const target = args.options.targetDirectory;
|
|
63
59
|
if (target !== undefined)
|
|
64
|
-
return cp_run({ sources: paths, dest: target, recursive });
|
|
60
|
+
return cp_run({ sources: paths, dest: target, recursive, intoFolder: true });
|
|
65
61
|
// `-t` alone is that line with the directory not said: a question
|
|
66
62
|
// (an-absent-value-is-a-question), and the answer wants a directory:
|
|
67
63
|
// `cp a b` without it means copy a ONTO b, the right reading of that line
|
|
@@ -77,7 +73,7 @@ async function cp_handle(args) {
|
|
|
77
73
|
exitCode_set(1);
|
|
78
74
|
return envelope_error('', undefined, `${chalk.red(destination_missing('cp'))}\n`);
|
|
79
75
|
}
|
|
80
|
-
return cp_run({ sources, dest: chosen, recursive });
|
|
76
|
+
return cp_run({ sources, dest: chosen, recursive, intoFolder: args.options.askTarget });
|
|
81
77
|
}
|
|
82
78
|
// The last operand is the destination, all others are sources.
|
|
83
79
|
return cp_run({ sources: paths.slice(0, -1), dest: paths[paths.length - 1] ?? '', recursive });
|
|
@@ -112,16 +108,6 @@ export const cpCommand = command_declare({
|
|
|
112
108
|
},
|
|
113
109
|
handler: cp_handle,
|
|
114
110
|
});
|
|
115
|
-
/**
|
|
116
|
-
* `cp` over words already split: the declaration's parse and handler.
|
|
117
|
-
*
|
|
118
|
-
* @param args - The words after `cp`.
|
|
119
|
-
* @returns An envelope whose rendered text reports progress and results and
|
|
120
|
-
* whose model carries per-source outcomes, or the refusal of a bad line.
|
|
121
|
-
*/
|
|
122
|
-
export async function builtin_cp(args) {
|
|
123
|
-
return declaredCommand_run(cpCommand, args);
|
|
124
|
-
}
|
|
125
111
|
/**
|
|
126
112
|
* Forgets the cached listings a write to a destination changes: beneath it
|
|
127
113
|
* (a recursive copy replaces them) and of its parent, by each name it has.
|
|
@@ -135,88 +121,99 @@ function destination_invalidate(listCache, names) {
|
|
|
135
121
|
listCache.cache_invalidate?.(path.posix.dirname(name));
|
|
136
122
|
}
|
|
137
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Copies one source. The mount chooses the final path alone: into a folder
|
|
126
|
+
* the destination holds, under the name the source was written with
|
|
127
|
+
* (before any link on it was followed).
|
|
128
|
+
*
|
|
129
|
+
* @param place - Where it goes, and how.
|
|
130
|
+
* @param src - The source as written.
|
|
131
|
+
* @param report - What is said, and the outcomes.
|
|
132
|
+
*/
|
|
133
|
+
async function source_copy(place, src, report) {
|
|
134
|
+
try {
|
|
135
|
+
const srcPath = await path_resolve(src);
|
|
136
|
+
report.rendered += place.count > 1 ? `${chalk.gray(`Copying ${srcPath}...`)}\n` : `Copying ${srcPath} to ${place.destPath}...\n`;
|
|
137
|
+
// Named by the logical path, its `.` and `..` settled as written, before any link is followed.
|
|
138
|
+
const logical = path.posix.resolve('/', srcPath);
|
|
139
|
+
const name = logical.slice(logical.lastIndexOf('/') + 1);
|
|
140
|
+
// Copied from where the store keeps it (a /proc data path, a link); named as it was asked.
|
|
141
|
+
const copied = await place.dispatcher.cp(await storePath_resolve(srcPath), place.destStore, {
|
|
142
|
+
recursive: place.recursive,
|
|
143
|
+
...(place.intoFolder ? { intoFolder: true } : {}),
|
|
144
|
+
...(name === '' ? {} : { name }),
|
|
145
|
+
});
|
|
146
|
+
if (place.count === 1)
|
|
147
|
+
report.rendered += `${cp_render(srcPath, place.destPath, copied.ok)}\n`;
|
|
148
|
+
if (!copied.ok) {
|
|
149
|
+
// The mount said WHY; one `cp:`, as mv says its own.
|
|
150
|
+
const said = copied.reason ?? vfsRefusal_text('cp', copied, srcPath, place.destPath);
|
|
151
|
+
report.renderedErr += `${chalk.red(said.startsWith('cp:') ? said : `cp: ${said}`)}\n`;
|
|
152
|
+
}
|
|
153
|
+
report.outcomes.push({ source: srcPath, copied: copied.ok });
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
157
|
+
report.renderedErr += `${chalk.red(`cp: ${src}: ${msg}`)}\n`;
|
|
158
|
+
report.outcomes.push({ source: src, copied: false });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The copy's envelope: what was said, the summary for several sources, and
|
|
163
|
+
* each source's outcome.
|
|
164
|
+
*
|
|
165
|
+
* @param report - What was said, and the outcomes.
|
|
166
|
+
* @param destPath - The destination as the session names it.
|
|
167
|
+
* @param several - Whether there were several sources.
|
|
168
|
+
* @returns The envelope, an error when any source was not copied.
|
|
169
|
+
*/
|
|
170
|
+
function cpEnvelope_make(report, destPath, several) {
|
|
171
|
+
const successCount = report.outcomes.filter((outcome) => outcome.copied).length;
|
|
172
|
+
const failCount = report.outcomes.length - successCount;
|
|
173
|
+
let rendered = report.rendered;
|
|
174
|
+
if (several) {
|
|
175
|
+
rendered += failCount === 0
|
|
176
|
+
? `${chalk.green(`✓ Copied ${successCount} file(s) to ${destPath}`)}\n`
|
|
177
|
+
: `${chalk.yellow(`⚠ Copied ${successCount} file(s), ${failCount} failed`)}\n`;
|
|
178
|
+
}
|
|
179
|
+
const modelData = { dest: destPath, outcomes: report.outcomes, copied: successCount, failed: failCount };
|
|
180
|
+
if (failCount === 0)
|
|
181
|
+
return envelope_ok(rendered, { kind: 'fs.cp', data: modelData });
|
|
182
|
+
const envelope = envelope_error(rendered, undefined, report.renderedErr || undefined);
|
|
183
|
+
envelope.model = { kind: 'fs.cp', data: modelData };
|
|
184
|
+
return envelope;
|
|
185
|
+
}
|
|
138
186
|
/**
|
|
139
187
|
* Copies files or directories: the shared typed core behind the parsed
|
|
140
|
-
* builtin and the typed API.
|
|
188
|
+
* builtin and the typed API. Several sources, or a target directory, go
|
|
189
|
+
* into one folder, proved once before anything is copied; anything else
|
|
190
|
+
* there refuses the whole command, every source reported not copied.
|
|
141
191
|
*
|
|
142
|
-
* @param options - Sources, destination, and the
|
|
192
|
+
* @param options - Sources, destination, the recursive flag, and whether the destination must be a folder.
|
|
143
193
|
* @returns An envelope whose rendered text reports results and whose
|
|
144
194
|
* `fs.cp` model carries per-source outcomes.
|
|
145
195
|
*/
|
|
146
196
|
export async function cp_run(options) {
|
|
147
|
-
const sources = options
|
|
148
|
-
const dest = options.dest;
|
|
197
|
+
const { sources, dest } = options;
|
|
149
198
|
if (sources.length === 0 || dest === '') {
|
|
150
199
|
return envelope_error(`${chalk.red('Usage: cp [-r] <source...> <dest>')}\n`);
|
|
151
200
|
}
|
|
152
|
-
const recursive = options.recursive ?? false;
|
|
153
201
|
const destPath = await path_resolve(dest);
|
|
154
202
|
// Written where the store keeps it: into a linked folder lands in the link's target.
|
|
155
203
|
const destStore = await storePath_resolve(destPath);
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const srcPath = await path_resolve(src);
|
|
165
|
-
// For multiple sources, show which file we're copying
|
|
166
|
-
if (sources.length > 1) {
|
|
167
|
-
rendered += `${chalk.gray(`Copying ${srcPath}...`)}\n`;
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
rendered += `Copying ${srcPath} to ${destPath}...\n`;
|
|
171
|
-
}
|
|
172
|
-
// Into a folder the destination names, the copy keeps its name.
|
|
173
|
-
const dispatcher = vfsDispatcher_get();
|
|
174
|
-
const finalDest = entry_isFolder(await pathEntry_find(dispatcher, destStore)) && !dispatcher.path_isVirtual(destStore)
|
|
175
|
-
? path.posix.join(destStore, path.posix.basename(srcPath))
|
|
176
|
-
: destStore;
|
|
177
|
-
// Copied from where the store keeps it (a /proc data path, a link); named as it was asked.
|
|
178
|
-
const copied = await dispatcher.cp(await storePath_resolve(srcPath), finalDest, { recursive });
|
|
179
|
-
const success = copied.ok;
|
|
180
|
-
if (sources.length === 1) {
|
|
181
|
-
rendered += `${cp_render(srcPath, destPath, success)}\n`;
|
|
182
|
-
}
|
|
183
|
-
if (!copied.ok) {
|
|
184
|
-
// The mount said WHY; a bare "Failed to copy" makes an operator
|
|
185
|
-
// guess at a reason that was already known. One `cp:`, as mv says its own.
|
|
186
|
-
const said = copied.reason ?? vfsRefusal_text('cp', copied, srcPath, destPath);
|
|
187
|
-
renderedErr += `${chalk.red(said.startsWith('cp:') ? said : `cp: ${said}`)}\n`;
|
|
188
|
-
}
|
|
189
|
-
outcomes.push({ source: srcPath, copied: success });
|
|
190
|
-
if (success) {
|
|
191
|
-
successCount++;
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
failCount++;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
catch (e) {
|
|
198
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
199
|
-
renderedErr += `${chalk.red(`cp: ${src}: ${msg}`)}\n`;
|
|
200
|
-
outcomes.push({ source: src, copied: false });
|
|
201
|
-
failCount++;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
destination_invalidate(listCache, [destPath, destStore]);
|
|
205
|
-
// Summary for multiple files
|
|
206
|
-
if (sources.length > 1) {
|
|
207
|
-
if (failCount === 0) {
|
|
208
|
-
rendered += `${chalk.green(`✓ Copied ${successCount} file(s) to ${destPath}`)}\n`;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
rendered += `${chalk.yellow(`⚠ Copied ${successCount} file(s), ${failCount} failed`)}\n`;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
const modelData = { dest: destPath, outcomes, copied: successCount, failed: failCount };
|
|
215
|
-
if (failCount > 0) {
|
|
216
|
-
const envelope = envelope_error(rendered, undefined, renderedErr || undefined);
|
|
217
|
-
envelope.model = { kind: 'fs.cp', data: modelData };
|
|
218
|
-
return envelope;
|
|
204
|
+
const dispatcher = vfsDispatcher_get();
|
|
205
|
+
const intoFolder = options.intoFolder === true || sources.length > 1;
|
|
206
|
+
const report = { rendered: '', renderedErr: '', outcomes: [] };
|
|
207
|
+
const refused = intoFolder ? await targetFolder_prove(dispatcher, 'cp', destStore, destPath) : null;
|
|
208
|
+
if (refused !== null) {
|
|
209
|
+
report.renderedErr = `${chalk.red(refused)}\n`;
|
|
210
|
+
report.outcomes = (await operands_fix(sources)).map((source) => ({ source, copied: false }));
|
|
211
|
+
return cpEnvelope_make(report, destPath, sources.length > 1);
|
|
219
212
|
}
|
|
220
|
-
|
|
213
|
+
const place = { dispatcher, destPath, destStore, recursive: options.recursive ?? false, intoFolder, count: sources.length };
|
|
214
|
+
for (const src of sources)
|
|
215
|
+
await source_copy(place, src, report);
|
|
216
|
+
destination_invalidate(listingCache_get(), [destPath, destStore]);
|
|
217
|
+
return cpEnvelope_make(report, destPath, sources.length > 1);
|
|
221
218
|
}
|
|
222
219
|
//# sourceMappingURL=cp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cp.js","sourceRoot":"","sources":["../../../src/builtins/fs/cp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cp.js","sourceRoot":"","sources":["../../../src/builtins/fs/cp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,eAAe,EAA8C,MAAM,kCAAkC,CAAC;AAC/G,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1G,OAAO,EAAE,SAAS,EAAE,eAAe,EAAuC,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAmB,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAgBxD,iCAAiC;AACjC,MAAM,UAAU,GAAG;IACjB,QAAQ,EAAE;QACR,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,qEAAqE,EAAE;KAC7I;IACD,OAAO,EAAE;QACP,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kCAAkC,EAAE;QACzF,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,sFAAsF,EAAE;QAC1H,eAAe,EAAE,E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|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DeliveryIntent } from './deliveryMatch.js';
|
|
2
|
+
export { deliveryIntent_matches, deliverySource_matches, sourceIntents_settle, storePath_normalise, type DeliveredFile, type DeliveryIntent, type SourceIntent } from './deliveryMatch.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reads the deliveries a line asks for, without running it.
|
|
5
|
+
*
|
|
6
|
+
* The order is the engine's: an unfinished quote, a background line and a
|
|
7
|
+
* host-shell line are settled first (none can be bound: no intent); then a
|
|
8
|
+
* list is split and each command read as a line of its own; a capture is
|
|
9
|
+
* not bound; a pipeline's first segment is read as a plain command, and a
|
|
10
|
+
* later one too when its raw leading word names a delivering command, which
|
|
11
|
+
* is how the engine decides to run it itself; a redirect
|
|
12
|
+
* is taken off and the command before it read; what is left is one plain
|
|
13
|
+
* command.
|
|
14
|
+
*
|
|
15
|
+
* @param line - The line as typed.
|
|
16
|
+
* @param backend - The backend of the session the line is sent to (`Backend.id`); a session of a backend with no delivering command, or of none named, asks for nothing.
|
|
17
|
+
* @returns The intents, in order; empty when the line delivers nothing the reader can bind.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* deliveryIntents_read('cd /x; download -f a.txt "./my folder" > log', 'chris'); // [{ verb: 'download', destination: './my folder' }]
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function deliveryIntents_read(line: string, backend: string | undefined): DeliveryIntent[];
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file What a line asks to have delivered to the machine it was typed on.
|
|
3
|
+
*
|
|
4
|
+
* A surface on another machine than its engine writes a file to its own
|
|
5
|
+
* disk when the engine asks it to (`fileDeliver`). The request names a
|
|
6
|
+
* destination, and the engine is across a wire: the surface must not take
|
|
7
|
+
* the engine's word for where on its disk to write. So before a line is
|
|
8
|
+
* sent, the surface reads from it, with the delivering command's own
|
|
9
|
+
* declaration, the destination its operator typed. A delivery is honoured
|
|
10
|
+
* only against that.
|
|
11
|
+
*
|
|
12
|
+
* Only a command listed here delivers. A source path, an option's value or
|
|
13
|
+
* a word of some other command on the line is never a destination.
|
|
14
|
+
*
|
|
15
|
+
* The line is taken apart in the order the engine takes it apart
|
|
16
|
+
* (`core/engine.ts`, `line_execute_run`), with the engine's own functions,
|
|
17
|
+
* so the command the reader sees is the command that will run. Where the
|
|
18
|
+
* reader cannot bind what would run to a place, it reports no intent, and
|
|
19
|
+
* a delivery that arrives is then refused: an unfinished quote, a line
|
|
20
|
+
* sent to the background, a host-shell line, a capture.
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { commandList_parse, quoteOpen_find } from '@fnndsc/menu';
|
|
25
|
+
import { storePath_normalise } from './deliveryMatch.js';
|
|
26
|
+
import { downloadCommand } from './download.js';
|
|
27
|
+
import { commandOperands_place } from '../../core/commandParse.js';
|
|
28
|
+
import { jobletLine_parse } from '../../core/joblets.js';
|
|
29
|
+
import { command_shellEscape_detect, pipeSegment_word, pipes_parse, redirect_parse } from '../../core/preprocess.js';
|
|
30
|
+
import { assignment_parse } from '../../core/variables.js';
|
|
31
|
+
import { shellWords_tokenize } from '../../lib/parser.js';
|
|
32
|
+
export { deliveryIntent_matches, deliverySource_matches, sourceIntents_settle, storePath_normalise } from './deliveryMatch.js';
|
|
33
|
+
/**
|
|
34
|
+
* Every command whose handler asks the surface to write a file, with the
|
|
35
|
+
* backend whose sessions register it. A session of another backend has no
|
|
36
|
+
* such builtin: there the same word, typed, is not the engine's command at
|
|
37
|
+
* all (later in a pipeline it is the host shell's program), and asks for
|
|
38
|
+
* no delivery.
|
|
39
|
+
*/
|
|
40
|
+
const DELIVERING = [
|
|
41
|
+
{ backend: 'chris', declaration: downloadCommand, operand: 'destination', sourceOperand: 'source' },
|
|
42
|
+
];
|
|
43
|
+
/**
|
|
44
|
+
* Reads what one plain command asks to have delivered: its words, as the
|
|
45
|
+
* engine tokenizes them, against its declaration.
|
|
46
|
+
*
|
|
47
|
+
* @param command - One command, with no list, pipe or redirect left in it.
|
|
48
|
+
* @param delivering_ - The delivering commands the session has.
|
|
49
|
+
* @returns Its intent, or none when it is not a delivering command or its declaration refuses the line.
|
|
50
|
+
*/
|
|
51
|
+
function commandIntents_read(command, delivering_) {
|
|
52
|
+
const words = shellWords_tokenize(command);
|
|
53
|
+
const verb = words[0]?.value;
|
|
54
|
+
const delivering = delivering_.find((one) => one.declaration.name === verb);
|
|
55
|
+
if (verb === undefined || delivering === undefined)
|
|
56
|
+
return [];
|
|
57
|
+
const placed = commandOperands_place(delivering.declaration, words.slice(1));
|
|
58
|
+
if (placed === null)
|
|
59
|
+
return [];
|
|
60
|
+
const sourceWords = placed.get(delivering.sourceOperand) ?? [];
|
|
61
|
+
const referenced = sourceWords.find(word_isReferenced);
|
|
62
|
+
if (referenced !== undefined) {
|
|
63
|
+
return [{ verb, destination: null, unbound: `its source ${JSON.stringify(referenced.value)} is written with a reference, whose value is not known here: type the path itself` }];
|
|
64
|
+
}
|
|
65
|
+
const sources = sourceWords.map(sourceIntent_read);
|
|
66
|
+
const unresolved = sources.find((one) => 'unresolved' in one);
|
|
67
|
+
if (unresolved !== undefined && 'unresolved' in unresolved)
|
|
68
|
+
return [{ verb, destination: null, unbound: unresolved.unresolved }];
|
|
69
|
+
const word = placed.get(delivering.operand)?.[0];
|
|
70
|
+
if (word === undefined)
|
|
71
|
+
return [{ verb, destination: null, sources }];
|
|
72
|
+
// A reference in the destination is expanded by the engine, across the
|
|
73
|
+
// wire. Its spelling here is not a place, and must not become one because
|
|
74
|
+
// the engine sends the same letters back. A quoted `'$x'` is plain text.
|
|
75
|
+
if (word_isReferenced(word)) {
|
|
76
|
+
return [{ verb, destination: null, unbound: `its destination ${JSON.stringify(word.value)} is written with a reference, whose value is not known here: type the path itself` }];
|
|
77
|
+
}
|
|
78
|
+
return [{ verb, destination: word.value, sources }];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Whether a word holds a reference the engine resolves (a quoted `'$x'` is plain text).
|
|
82
|
+
*
|
|
83
|
+
* @param word - The word.
|
|
84
|
+
* @returns True when it does.
|
|
85
|
+
*/
|
|
86
|
+
function word_isReferenced(word) {
|
|
87
|
+
return (word.segments ?? []).some((segment) => segment.ref !== null);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* How a delivered file is bound to one source word: by the operand as typed (quoting removed), which the root the
|
|
91
|
+
* engine resolved must be; by the operand's pattern when the engine expands it. A source whose place only the
|
|
92
|
+
* session knows (`.`, `..`, `~`, or a path climbing with `..`) binds nothing.
|
|
93
|
+
*
|
|
94
|
+
* @param word - A source word.
|
|
95
|
+
* @returns The binding, or why there is none.
|
|
96
|
+
*/
|
|
97
|
+
function sourceIntent_read(word) {
|
|
98
|
+
const spelled = word.pathnameExpansion ? word.globPattern : word.value;
|
|
99
|
+
const parts = spelled.split('/');
|
|
100
|
+
// `.`, `./` and `././` alike are the session folder itself: only the session knows it.
|
|
101
|
+
if (storePath_normalise(spelled) === '' || parts.includes('..') || parts[0] === '~') {
|
|
102
|
+
return { unresolved: `its source ${JSON.stringify(word.value)} names a place only the session knows: type the folder's path` };
|
|
103
|
+
}
|
|
104
|
+
return word.pathnameExpansion ? { pattern: spelled } : { operand: spelled };
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether a pipeline's later segment is one the engine would run as a
|
|
108
|
+
* delivering command, by the engine's own rule.
|
|
109
|
+
*
|
|
110
|
+
* `pipe_execute` (`core/dispatch.ts`) decides a later segment from its raw
|
|
111
|
+
* leading word, split on white space, before any quoting is read: a word
|
|
112
|
+
* that names a builtin runs in the engine, anything else goes to the
|
|
113
|
+
* surface's host shell. So `"download" a b` in that position is a host
|
|
114
|
+
* program, not the engine's `download`, and asks for no delivery. The rule
|
|
115
|
+
* is {@link pipeSegment_word}, which `pipe_execute` uses too.
|
|
116
|
+
*
|
|
117
|
+
* @param segment - A segment after the first.
|
|
118
|
+
* @param delivering - The delivering commands the session has.
|
|
119
|
+
* @returns True when its raw leading word is one of their names.
|
|
120
|
+
*/
|
|
121
|
+
function laterSegment_runsInEngine(segment, delivering) {
|
|
122
|
+
const word = pipeSegment_word(segment);
|
|
123
|
+
return delivering.some((one) => one.declaration.name === word);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Reads the deliveries a line asks for, without running it.
|
|
127
|
+
*
|
|
128
|
+
* The order is the engine's: an unfinished quote, a background line and a
|
|
129
|
+
* host-shell line are settled first (none can be bound: no intent); then a
|
|
130
|
+
* list is split and each command read as a line of its own; a capture is
|
|
131
|
+
* not bound; a pipeline's first segment is read as a plain command, and a
|
|
132
|
+
* later one too when its raw leading word names a delivering command, which
|
|
133
|
+
* is how the engine decides to run it itself; a redirect
|
|
134
|
+
* is taken off and the command before it read; what is left is one plain
|
|
135
|
+
* command.
|
|
136
|
+
*
|
|
137
|
+
* @param line - The line as typed.
|
|
138
|
+
* @param backend - The backend of the session the line is sent to (`Backend.id`); a session of a backend with no delivering command, or of none named, asks for nothing.
|
|
139
|
+
* @returns The intents, in order; empty when the line delivers nothing the reader can bind.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* deliveryIntents_read('cd /x; download -f a.txt "./my folder" > log', 'chris'); // [{ verb: 'download', destination: './my folder' }]
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
export function deliveryIntents_read(line, backend) {
|
|
147
|
+
const delivering = DELIVERING.filter((one) => one.backend === backend);
|
|
148
|
+
return delivering.length === 0 ? [] : lineIntents_read(line, delivering);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reads one line's intents against the delivering commands a session has.
|
|
152
|
+
*
|
|
153
|
+
* @param line - The line, or one command of a list.
|
|
154
|
+
* @param delivering - The delivering commands the session has.
|
|
155
|
+
* @returns The intents, in order.
|
|
156
|
+
*/
|
|
157
|
+
function lineIntents_read(line, delivering) {
|
|
158
|
+
const trimmed = line.trim();
|
|
159
|
+
if (trimmed === '')
|
|
160
|
+
return [];
|
|
161
|
+
if (command_shellEscape_detect(trimmed))
|
|
162
|
+
return [];
|
|
163
|
+
if (quoteOpen_find(trimmed) !== null)
|
|
164
|
+
return [];
|
|
165
|
+
if (jobletLine_parse(trimmed) !== null)
|
|
166
|
+
return [];
|
|
167
|
+
const listed = commandList_parse(trimmed);
|
|
168
|
+
// A command in a conditional arm (after `&&` or `||`) may or may not run: it is bound to nothing.
|
|
169
|
+
if (listed.some((one) => one.when !== 'always'))
|
|
170
|
+
return [];
|
|
171
|
+
if (listed.length > 1)
|
|
172
|
+
return listed.flatMap((one) => lineIntents_read(one.command, delivering));
|
|
173
|
+
if (assignment_parse(trimmed) !== null)
|
|
174
|
+
return [];
|
|
175
|
+
const segments = pipes_parse(trimmed);
|
|
176
|
+
if (segments.length > 1) {
|
|
177
|
+
return segments.flatMap((segment, at) => (at === 0 || laterSegment_runsInEngine(segment, delivering) ? commandIntents_read(segment, delivering) : []));
|
|
178
|
+
}
|
|
179
|
+
const redirect = redirect_parse(trimmed);
|
|
180
|
+
return commandIntents_read(redirect !== null ? redirect.command : trimmed, delivering);
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=deliveryIntent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveryIntent.js","sourceRoot":"","sources":["../../../src/builtins/fs/deliveryIntent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAoB,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAA0C,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,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