@fnndsc/salsa 4.5.6 → 4.6.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/README.md +0 -2
- package/dist/compute/index.d.ts +0 -9
- package/dist/compute/index.js +0 -16
- package/dist/compute/index.js.map +1 -1
- package/dist/dag/feedData.js +166 -73
- package/dist/dag/feedData.js.map +1 -1
- package/dist/dag/feedLoad.d.ts +1 -1
- package/dist/dag/feedLoad.js +6 -4
- package/dist/dag/feedLoad.js.map +1 -1
- package/dist/dicom/pixels.js +95 -36
- package/dist/dicom/pixels.js.map +1 -1
- package/dist/dicom/series.d.ts +4 -1
- package/dist/dicom/series.js +80 -31
- package/dist/dicom/series.js.map +1 -1
- package/dist/dicom/tags.d.ts +28 -0
- package/dist/dicom/tags.js +30 -0
- package/dist/dicom/tags.js.map +1 -1
- package/dist/files/copy.d.ts +197 -0
- package/dist/files/copy.js +636 -0
- package/dist/files/copy.js.map +1 -0
- package/dist/files/copyFolder.d.ts +103 -0
- package/dist/files/copyFolder.js +199 -0
- package/dist/files/copyFolder.js.map +1 -0
- package/dist/files/create.d.ts +178 -0
- package/dist/files/create.js +444 -0
- package/dist/files/create.js.map +1 -0
- package/dist/files/download.d.ts +188 -0
- package/dist/files/download.js +541 -0
- package/dist/files/download.js.map +1 -0
- package/dist/files/index.d.ts +69 -141
- package/dist/files/index.js +184 -535
- package/dist/files/index.js.map +1 -1
- package/dist/files/listing.d.ts +132 -0
- package/dist/files/listing.js +179 -0
- package/dist/files/listing.js.map +1 -0
- package/dist/files/move.d.ts +125 -0
- package/dist/files/move.js +334 -0
- package/dist/files/move.js.map +1 -0
- package/dist/files/pathMapper.d.ts +24 -1
- package/dist/files/pathMapper.js +108 -47
- package/dist/files/pathMapper.js.map +1 -1
- package/dist/files/proof.d.ts +315 -0
- package/dist/files/proof.js +574 -0
- package/dist/files/proof.js.map +1 -0
- package/dist/files/removal.d.ts +223 -0
- package/dist/files/removal.js +318 -0
- package/dist/files/removal.js.map +1 -0
- package/dist/files/replace.d.ts +175 -0
- package/dist/files/replace.js +582 -0
- package/dist/files/replace.js.map +1 -0
- package/dist/files/upload.d.ts +205 -0
- package/dist/files/upload.js +478 -0
- package/dist/files/upload.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +45 -32
- package/dist/index.js.map +1 -1
- package/dist/jobs/index.d.ts +1 -1
- package/dist/jobs/index.js +2 -2
- package/dist/jobs/index.js.map +1 -1
- package/dist/jobs/jobOps.d.ts +20 -13
- package/dist/jobs/jobOps.js +41 -37
- package/dist/jobs/jobOps.js.map +1 -1
- package/dist/pacs/anonymise.d.ts +17 -36
- package/dist/pacs/anonymise.js +29 -67
- package/dist/pacs/anonymise.js.map +1 -1
- package/dist/pipelines/index.d.ts +1 -13
- package/dist/pipelines/index.js +0 -38
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/invocation.js +321 -167
- package/dist/pipelines/invocation.js.map +1 -1
- package/dist/pipelines/manifest.js.map +1 -1
- package/dist/pipelines/packages.d.ts +11 -8
- package/dist/pipelines/packages.js +253 -77
- package/dist/pipelines/packages.js.map +1 -1
- package/dist/plugins/adminToken.d.ts +67 -0
- package/dist/plugins/adminToken.js +77 -0
- package/dist/plugins/adminToken.js.map +1 -0
- package/dist/plugins/index.d.ts +0 -7
- package/dist/plugins/index.js +0 -16
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/peer_search.d.ts +0 -15
- package/dist/plugins/peer_search.js +0 -25
- package/dist/plugins/peer_search.js.map +1 -1
- package/dist/plugins/plugin_add.d.ts +14 -2
- package/dist/plugins/plugin_add.js +42 -13
- package/dist/plugins/plugin_add.js.map +1 -1
- package/dist/plugins/plugin_docker.d.ts +25 -0
- package/dist/plugins/plugin_docker.js +33 -0
- package/dist/plugins/plugin_docker.js.map +1 -1
- package/dist/plugins/plugin_register.d.ts +0 -10
- package/dist/plugins/plugin_register.js +3 -54
- package/dist/plugins/plugin_register.js.map +1 -1
- package/dist/plugins/plugin_sync.js +45 -22
- package/dist/plugins/plugin_sync.js.map +1 -1
- package/dist/plugins/plugin_validate.js +47 -13
- package/dist/plugins/plugin_validate.js.map +1 -1
- package/dist/plugins/store_import.d.ts +0 -9
- package/dist/plugins/store_import.js +3 -29
- package/dist/plugins/store_import.js.map +1 -1
- package/dist/retrieve/task.d.ts +137 -0
- package/dist/retrieve/task.js +41 -0
- package/dist/retrieve/task.js.map +1 -0
- package/dist/retrieve/watch.d.ts +2 -118
- package/dist/retrieve/watch.js +452 -321
- package/dist/retrieve/watch.js.map +1 -1
- package/dist/vfs/providers/etc.d.ts +6 -4
- package/dist/vfs/providers/etc.js +12 -4
- package/dist/vfs/providers/etc.js.map +1 -1
- package/dist/vfs/providers/native.d.ts +116 -39
- package/dist/vfs/providers/native.js +291 -347
- package/dist/vfs/providers/native.js.map +1 -1
- package/dist/vfs/providers/pacs.d.ts +29 -3
- package/dist/vfs/providers/pacs.js +303 -73
- package/dist/vfs/providers/pacs.js.map +1 -1
- package/dist/vfs/providers/pacs_content.js +22 -6
- package/dist/vfs/providers/pacs_content.js.map +1 -1
- package/dist/vfs/providers/proc/backfill.d.ts +46 -0
- package/dist/vfs/providers/proc/backfill.js +147 -0
- package/dist/vfs/providers/proc/backfill.js.map +1 -0
- package/dist/vfs/providers/proc/book.d.ts +176 -0
- package/dist/vfs/providers/proc/book.js +73 -0
- package/dist/vfs/providers/proc/book.js.map +1 -0
- package/dist/vfs/providers/proc/catchup.d.ts +69 -0
- package/dist/vfs/providers/proc/catchup.js +125 -0
- package/dist/vfs/providers/proc/catchup.js.map +1 -0
- package/dist/vfs/providers/proc/feedIndex.d.ts +146 -0
- package/dist/vfs/providers/proc/feedIndex.js +354 -0
- package/dist/vfs/providers/proc/feedIndex.js.map +1 -0
- package/dist/vfs/providers/proc/feedTopology.d.ts +85 -0
- package/dist/vfs/providers/proc/feedTopology.js +192 -0
- package/dist/vfs/providers/proc/feedTopology.js.map +1 -0
- package/dist/vfs/providers/proc/locate.d.ts +60 -0
- package/dist/vfs/providers/proc/locate.js +103 -0
- package/dist/vfs/providers/proc/locate.js.map +1 -0
- package/dist/vfs/providers/proc/path.d.ts +50 -0
- package/dist/vfs/providers/proc/path.js +106 -0
- package/dist/vfs/providers/proc/path.js.map +1 -0
- package/dist/vfs/providers/proc/roster.d.ts +95 -0
- package/dist/vfs/providers/proc/roster.js +425 -0
- package/dist/vfs/providers/proc/roster.js.map +1 -0
- package/dist/vfs/providers/proc/rows.d.ts +120 -0
- package/dist/vfs/providers/proc/rows.js +181 -0
- package/dist/vfs/providers/proc/rows.js.map +1 -0
- package/dist/vfs/providers/proc/subtree.d.ts +73 -0
- package/dist/vfs/providers/proc/subtree.js +125 -0
- package/dist/vfs/providers/proc/subtree.js.map +1 -0
- package/dist/vfs/providers/proc/sweep.d.ts +89 -0
- package/dist/vfs/providers/proc/sweep.js +297 -0
- package/dist/vfs/providers/proc/sweep.js.map +1 -0
- package/dist/vfs/providers/proc.d.ts +47 -346
- package/dist/vfs/providers/proc.js +349 -1806
- package/dist/vfs/providers/proc.js.map +1 -1
- package/dist/vfs/providers/share.js +4 -1
- package/dist/vfs/providers/share.js.map +1 -1
- package/package.json +3 -3
- package/dist/pacs/resultDecode.d.ts +0 -13
- package/dist/pacs/resultDecode.js +0 -19
- package/dist/pacs/resultDecode.js.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Replacing a file's content without losing the old content on the way.
|
|
3
|
+
*
|
|
4
|
+
* CUBE's upload does not replace: uploaded over a held path, the bytes land
|
|
5
|
+
* under another name, or the old content stays. So a rewrite used to remove
|
|
6
|
+
* the old file and then create the new one, two requests, and a failure of
|
|
7
|
+
* the second left nothing at the name. Here the old content stays
|
|
8
|
+
* recoverable until the new content is verified at the name:
|
|
9
|
+
*
|
|
10
|
+
* 1. The new content is uploaded beside the old, under a staging name.
|
|
11
|
+
* 2. The old file is moved aside, not deleted.
|
|
12
|
+
* 3. The new file is moved onto the name.
|
|
13
|
+
* 4. The old file is deleted.
|
|
14
|
+
*
|
|
15
|
+
* Every step acts on a file by its id, never on "whatever is at this path",
|
|
16
|
+
* and only after CUBE has said the id is at the path it is taken to be at.
|
|
17
|
+
* A move's reply can be lost though the move happened, so after an error
|
|
18
|
+
* the store is asked where the file is before anything is undone; a move
|
|
19
|
+
* or a look that throws is read the same way, never as a failure that
|
|
20
|
+
* skips the words naming where each copy is. And one
|
|
21
|
+
* rule covers every branch: nothing is moved or deleted unless both its id
|
|
22
|
+
* and its place are known. When either is uncertain, the copies stay and
|
|
23
|
+
* the error names their paths.
|
|
24
|
+
*
|
|
25
|
+
* A write is bound to one client, the session's when it began: every
|
|
26
|
+
* proof, the upload, each move, each lookup and each cleanup go to it, and
|
|
27
|
+
* before each request that changes anything it is asked to be still the
|
|
28
|
+
* session's. A connection that changed stops the write where it is: what
|
|
29
|
+
* was not yet done is not asked, nothing is undone on the new connection,
|
|
30
|
+
* and the error names where each copy is.
|
|
31
|
+
*
|
|
32
|
+
* Key components:
|
|
33
|
+
* - file_write: write content to a path on proof of what holds it.
|
|
34
|
+
* - fileWrite_bind: the client a write is bound to when what it saves is read.
|
|
35
|
+
* - file_store: the same on a bound client, a file already there replaced, kept or refused.
|
|
36
|
+
* - file_createProved: store content at a path proved free, create-only.
|
|
37
|
+
* - file_replace: put new content at a path that holds a file.
|
|
38
|
+
*
|
|
39
|
+
* Typical usage:
|
|
40
|
+
* ```ts
|
|
41
|
+
* const written: boolean = await file_write('/home/ada/notes.txt', new Blob(['new']));
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Dependencies: cumin's `chrisIO` (the session's client, bound as a
|
|
45
|
+
* `HolderClient`: an upload that answers what was stored, a move and a
|
|
46
|
+
* delete by id, a lookup of a file's place by id, the parent of a proof
|
|
47
|
+
* found fresh) and the strict lookup of `./proof.js`. CUBE has no move that refuses a held destination,
|
|
48
|
+
* so the check and the move are two requests and a file can arrive between
|
|
49
|
+
* them (docs/CUBE-gaps.adoc). Paths are absolute CUBE paths.
|
|
50
|
+
*
|
|
51
|
+
* @module
|
|
52
|
+
*/
|
|
53
|
+
import { type HolderClient } from '@fnndsc/cumin';
|
|
54
|
+
import { type VfsOutcome } from '@fnndsc/fond';
|
|
55
|
+
/**
|
|
56
|
+
* Stores content at a path proved to hold nothing, and makes sure it is
|
|
57
|
+
* there.
|
|
58
|
+
*
|
|
59
|
+
* CUBE may store an upload under another name than the one asked for. Then
|
|
60
|
+
* the file is moved onto the name by its id, through the same proved move
|
|
61
|
+
* as any other, and the write is a success only when the file is seen
|
|
62
|
+
* there.
|
|
63
|
+
*
|
|
64
|
+
* @param acts - The client the write is bound to.
|
|
65
|
+
* @param target - The absolute CUBE path, proved absent by the caller.
|
|
66
|
+
* @param content - The content.
|
|
67
|
+
* @returns True when the path holds the content; false otherwise, with the
|
|
68
|
+
* reason on the error stack.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const created: boolean = await file_createProved(acts, '/home/ada/copy/scan.dcm', new Blob([bytes]));
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function file_createProved(acts: HolderClient, target: string, content: Blob): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* What a write does with a file already at its path: `replace` its content
|
|
78
|
+
* ({@link file_replace}), `keep` it as it is and write nothing (`touch`),
|
|
79
|
+
* or `refuse` the write (a copy, an export not forced).
|
|
80
|
+
*/
|
|
81
|
+
export type FileAtPath = 'replace' | 'keep' | 'refuse';
|
|
82
|
+
/** What a stored write came to: the content `created` at a free path, `replaced` over a file, or a file `kept` as it was. */
|
|
83
|
+
export type StoreDone = 'created' | 'replaced' | 'kept';
|
|
84
|
+
/**
|
|
85
|
+
* Writes content to a path on proof of what holds it, on the client the
|
|
86
|
+
* write is bound to.
|
|
87
|
+
*
|
|
88
|
+
* Nothing there: the content is stored and seen at the path. One file
|
|
89
|
+
* there: replaced, kept, or refused, as asked. Anything else (a folder, a
|
|
90
|
+
* link, more than one holder, or a lookup that could not be completed) and
|
|
91
|
+
* nothing is written: a listing that failed or was cut short is not taken
|
|
92
|
+
* for an empty one.
|
|
93
|
+
*
|
|
94
|
+
* @param acts - The client the write is bound to.
|
|
95
|
+
* @param target - The absolute CUBE path, from the root.
|
|
96
|
+
* @param content - The content.
|
|
97
|
+
* @param existing - What becomes of a file already there.
|
|
98
|
+
* @param folderRequired - True when the folder the path is in must already
|
|
99
|
+
* be there (a copy into a folder): one proved absent refuses the write,
|
|
100
|
+
* where otherwise storing would make it.
|
|
101
|
+
* @returns What was done; or why not (`EEXIST` a file refused, `EISDIR` a
|
|
102
|
+
* folder, `EPERM` several holders or a link, `ENOTDIR` a file on the
|
|
103
|
+
* way, `ENOENT` a required folder gone, `EIO` otherwise), its words on
|
|
104
|
+
* the error stack.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const stored: VfsOutcome<StoreDone> = await file_store(acts, '/home/ada/notes.txt', new Blob(['draft']), 'refuse');
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function file_store(acts: HolderClient, target: string, content: Blob, existing: FileAtPath, folderRequired?: boolean): Promise<VfsOutcome<StoreDone>>;
|
|
112
|
+
/**
|
|
113
|
+
* The session's client, bound when what a write will save is read (an
|
|
114
|
+
* edit's read), for {@link file_write} to be given: the save then goes to
|
|
115
|
+
* that client, or, once the connection has changed, nowhere.
|
|
116
|
+
*
|
|
117
|
+
* @returns The binding; null when there is no connection now (a write
|
|
118
|
+
* given null is refused, and says so, when it is asked: it is never
|
|
119
|
+
* bound later, to whatever connection there is then).
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* const bound: HolderClient | null = await fileWrite_bind();
|
|
124
|
+
* const saved: boolean = await file_write('/home/ada/notes.txt', new Blob(['edited']), bound);
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function fileWrite_bind(): Promise<HolderClient | null>;
|
|
128
|
+
/**
|
|
129
|
+
* Writes content to a path, whatever holds it now, on proof of what does.
|
|
130
|
+
*
|
|
131
|
+
* Nothing there: the content is stored and seen at the path. One file
|
|
132
|
+
* there: its content is replaced by {@link file_replace}. Anything else (a
|
|
133
|
+
* folder, a link, more than one holder, or a lookup that could not be
|
|
134
|
+
* completed) and nothing is written: a listing that failed or was cut short
|
|
135
|
+
* is not taken for an empty one. The proof and every step after it go to
|
|
136
|
+
* one client: the one bound when the content was read, when the caller
|
|
137
|
+
* bound one (a connection changed since refuses the write, unasked; a bind
|
|
138
|
+
* that failed then, given as null, refuses it too), else the session's,
|
|
139
|
+
* bound here.
|
|
140
|
+
*
|
|
141
|
+
* @param written - The CUBE path; one written without its leading slash
|
|
142
|
+
* is read from the root.
|
|
143
|
+
* @param content - The content.
|
|
144
|
+
* @param bound - The client bound when what is written was read (an
|
|
145
|
+
* edit's read); null when that bind failed; omitted when none was asked for.
|
|
146
|
+
* @returns True when the path holds the content; false otherwise, with the
|
|
147
|
+
* reason on the error stack.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const written: boolean = await file_write('/home/ada/notes.txt', new Blob(['draft']));
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function file_write(written: string, content: Blob, bound?: HolderClient | null): Promise<boolean>;
|
|
155
|
+
/**
|
|
156
|
+
* Puts new content at a path that holds a file, keeping the old content
|
|
157
|
+
* recoverable until the new is verified in place.
|
|
158
|
+
*
|
|
159
|
+
* @param rewritten - The CUBE path of the file to rewrite; one written
|
|
160
|
+
* without its leading slash is read from the root.
|
|
161
|
+
* @param content - The new content.
|
|
162
|
+
* @param oldId - The id of the file now at the path.
|
|
163
|
+
* @param bound - The client the write is bound to; the session's, bound
|
|
164
|
+
* here, when not given.
|
|
165
|
+
* @returns True when the path holds the new content. False otherwise, with
|
|
166
|
+
* the reason on the error stack; the old content is then still at the
|
|
167
|
+
* path, or, where that could not be restored or made sure of, at a path
|
|
168
|
+
* the error names.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* const replaced: boolean = await file_replace('/home/ada/notes.txt', new Blob(['second draft']), 41);
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare function file_replace(rewritten: string, content: Blob, oldId: number, bound?: HolderClient): Promise<boolean>;
|