@fnndsc/salsa 4.5.7 → 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.
Files changed (158) hide show
  1. package/README.md +0 -2
  2. package/dist/compute/index.d.ts +0 -9
  3. package/dist/compute/index.js +0 -16
  4. package/dist/compute/index.js.map +1 -1
  5. package/dist/dag/feedData.js +166 -73
  6. package/dist/dag/feedData.js.map +1 -1
  7. package/dist/dag/feedLoad.d.ts +1 -1
  8. package/dist/dag/feedLoad.js +6 -4
  9. package/dist/dag/feedLoad.js.map +1 -1
  10. package/dist/dicom/pixels.js +95 -36
  11. package/dist/dicom/pixels.js.map +1 -1
  12. package/dist/dicom/series.d.ts +4 -1
  13. package/dist/dicom/series.js +80 -31
  14. package/dist/dicom/series.js.map +1 -1
  15. package/dist/dicom/tags.d.ts +28 -0
  16. package/dist/dicom/tags.js +30 -0
  17. package/dist/dicom/tags.js.map +1 -1
  18. package/dist/files/copy.d.ts +197 -0
  19. package/dist/files/copy.js +636 -0
  20. package/dist/files/copy.js.map +1 -0
  21. package/dist/files/copyFolder.d.ts +103 -0
  22. package/dist/files/copyFolder.js +199 -0
  23. package/dist/files/copyFolder.js.map +1 -0
  24. package/dist/files/create.d.ts +178 -0
  25. package/dist/files/create.js +444 -0
  26. package/dist/files/create.js.map +1 -0
  27. package/dist/files/download.d.ts +188 -0
  28. package/dist/files/download.js +541 -0
  29. package/dist/files/download.js.map +1 -0
  30. package/dist/files/index.d.ts +69 -141
  31. package/dist/files/index.js +184 -535
  32. package/dist/files/index.js.map +1 -1
  33. package/dist/files/listing.d.ts +132 -0
  34. package/dist/files/listing.js +179 -0
  35. package/dist/files/listing.js.map +1 -0
  36. package/dist/files/move.d.ts +125 -0
  37. package/dist/files/move.js +334 -0
  38. package/dist/files/move.js.map +1 -0
  39. package/dist/files/pathMapper.d.ts +24 -1
  40. package/dist/files/pathMapper.js +108 -47
  41. package/dist/files/pathMapper.js.map +1 -1
  42. package/dist/files/proof.d.ts +315 -0
  43. package/dist/files/proof.js +574 -0
  44. package/dist/files/proof.js.map +1 -0
  45. package/dist/files/removal.d.ts +223 -0
  46. package/dist/files/removal.js +318 -0
  47. package/dist/files/removal.js.map +1 -0
  48. package/dist/files/replace.d.ts +175 -0
  49. package/dist/files/replace.js +582 -0
  50. package/dist/files/replace.js.map +1 -0
  51. package/dist/files/upload.d.ts +205 -0
  52. package/dist/files/upload.js +478 -0
  53. package/dist/files/upload.js.map +1 -0
  54. package/dist/index.d.ts +14 -2
  55. package/dist/index.js +45 -32
  56. package/dist/index.js.map +1 -1
  57. package/dist/jobs/index.d.ts +1 -1
  58. package/dist/jobs/index.js +1 -2
  59. package/dist/jobs/index.js.map +1 -1
  60. package/dist/jobs/jobOps.d.ts +0 -13
  61. package/dist/jobs/jobOps.js +0 -37
  62. package/dist/jobs/jobOps.js.map +1 -1
  63. package/dist/pacs/anonymise.d.ts +17 -36
  64. package/dist/pacs/anonymise.js +29 -67
  65. package/dist/pacs/anonymise.js.map +1 -1
  66. package/dist/pipelines/index.d.ts +1 -13
  67. package/dist/pipelines/index.js +0 -38
  68. package/dist/pipelines/index.js.map +1 -1
  69. package/dist/pipelines/invocation.js +321 -167
  70. package/dist/pipelines/invocation.js.map +1 -1
  71. package/dist/pipelines/manifest.js.map +1 -1
  72. package/dist/pipelines/packages.d.ts +11 -8
  73. package/dist/pipelines/packages.js +253 -77
  74. package/dist/pipelines/packages.js.map +1 -1
  75. package/dist/plugins/adminToken.d.ts +67 -0
  76. package/dist/plugins/adminToken.js +77 -0
  77. package/dist/plugins/adminToken.js.map +1 -0
  78. package/dist/plugins/index.d.ts +0 -7
  79. package/dist/plugins/index.js +0 -16
  80. package/dist/plugins/index.js.map +1 -1
  81. package/dist/plugins/peer_search.d.ts +0 -15
  82. package/dist/plugins/peer_search.js +0 -25
  83. package/dist/plugins/peer_search.js.map +1 -1
  84. package/dist/plugins/plugin_add.d.ts +14 -2
  85. package/dist/plugins/plugin_add.js +42 -13
  86. package/dist/plugins/plugin_add.js.map +1 -1
  87. package/dist/plugins/plugin_docker.d.ts +25 -0
  88. package/dist/plugins/plugin_docker.js +33 -0
  89. package/dist/plugins/plugin_docker.js.map +1 -1
  90. package/dist/plugins/plugin_register.d.ts +0 -10
  91. package/dist/plugins/plugin_register.js +3 -54
  92. package/dist/plugins/plugin_register.js.map +1 -1
  93. package/dist/plugins/plugin_sync.js +45 -22
  94. package/dist/plugins/plugin_sync.js.map +1 -1
  95. package/dist/plugins/plugin_validate.js +47 -13
  96. package/dist/plugins/plugin_validate.js.map +1 -1
  97. package/dist/plugins/store_import.d.ts +0 -9
  98. package/dist/plugins/store_import.js +3 -29
  99. package/dist/plugins/store_import.js.map +1 -1
  100. package/dist/retrieve/task.d.ts +137 -0
  101. package/dist/retrieve/task.js +41 -0
  102. package/dist/retrieve/task.js.map +1 -0
  103. package/dist/retrieve/watch.d.ts +2 -118
  104. package/dist/retrieve/watch.js +452 -321
  105. package/dist/retrieve/watch.js.map +1 -1
  106. package/dist/vfs/providers/etc.d.ts +6 -4
  107. package/dist/vfs/providers/etc.js +12 -4
  108. package/dist/vfs/providers/etc.js.map +1 -1
  109. package/dist/vfs/providers/native.d.ts +116 -39
  110. package/dist/vfs/providers/native.js +291 -347
  111. package/dist/vfs/providers/native.js.map +1 -1
  112. package/dist/vfs/providers/pacs.d.ts +29 -3
  113. package/dist/vfs/providers/pacs.js +303 -73
  114. package/dist/vfs/providers/pacs.js.map +1 -1
  115. package/dist/vfs/providers/pacs_content.js +22 -6
  116. package/dist/vfs/providers/pacs_content.js.map +1 -1
  117. package/dist/vfs/providers/proc/backfill.d.ts +46 -0
  118. package/dist/vfs/providers/proc/backfill.js +147 -0
  119. package/dist/vfs/providers/proc/backfill.js.map +1 -0
  120. package/dist/vfs/providers/proc/book.d.ts +176 -0
  121. package/dist/vfs/providers/proc/book.js +73 -0
  122. package/dist/vfs/providers/proc/book.js.map +1 -0
  123. package/dist/vfs/providers/proc/catchup.d.ts +69 -0
  124. package/dist/vfs/providers/proc/catchup.js +125 -0
  125. package/dist/vfs/providers/proc/catchup.js.map +1 -0
  126. package/dist/vfs/providers/proc/feedIndex.d.ts +146 -0
  127. package/dist/vfs/providers/proc/feedIndex.js +354 -0
  128. package/dist/vfs/providers/proc/feedIndex.js.map +1 -0
  129. package/dist/vfs/providers/proc/feedTopology.d.ts +85 -0
  130. package/dist/vfs/providers/proc/feedTopology.js +192 -0
  131. package/dist/vfs/providers/proc/feedTopology.js.map +1 -0
  132. package/dist/vfs/providers/proc/locate.d.ts +60 -0
  133. package/dist/vfs/providers/proc/locate.js +103 -0
  134. package/dist/vfs/providers/proc/locate.js.map +1 -0
  135. package/dist/vfs/providers/proc/path.d.ts +50 -0
  136. package/dist/vfs/providers/proc/path.js +106 -0
  137. package/dist/vfs/providers/proc/path.js.map +1 -0
  138. package/dist/vfs/providers/proc/roster.d.ts +95 -0
  139. package/dist/vfs/providers/proc/roster.js +425 -0
  140. package/dist/vfs/providers/proc/roster.js.map +1 -0
  141. package/dist/vfs/providers/proc/rows.d.ts +120 -0
  142. package/dist/vfs/providers/proc/rows.js +181 -0
  143. package/dist/vfs/providers/proc/rows.js.map +1 -0
  144. package/dist/vfs/providers/proc/subtree.d.ts +73 -0
  145. package/dist/vfs/providers/proc/subtree.js +125 -0
  146. package/dist/vfs/providers/proc/subtree.js.map +1 -0
  147. package/dist/vfs/providers/proc/sweep.d.ts +89 -0
  148. package/dist/vfs/providers/proc/sweep.js +297 -0
  149. package/dist/vfs/providers/proc/sweep.js.map +1 -0
  150. package/dist/vfs/providers/proc.d.ts +47 -346
  151. package/dist/vfs/providers/proc.js +349 -1806
  152. package/dist/vfs/providers/proc.js.map +1 -1
  153. package/dist/vfs/providers/share.js +4 -1
  154. package/dist/vfs/providers/share.js.map +1 -1
  155. package/package.json +3 -3
  156. package/dist/pacs/resultDecode.d.ts +0 -13
  157. package/dist/pacs/resultDecode.js +0 -19
  158. package/dist/pacs/resultDecode.js.map +0 -1
@@ -0,0 +1,636 @@
1
+ "use strict";
2
+ /**
3
+ * @file Copying inside CUBE, create-only: nothing a copy writes lands on a name something already holds.
4
+ *
5
+ * CUBE has no copy; a copy downloads each file and stores it again. Its
6
+ * source is proved first, fresh on the copy's one client (one folder at the
7
+ * path), and read whole by id: that folder's folders, files and links each
8
+ * read in full at its own collections, every row placed directly inside
9
+ * the folder it was listed in, each folder below then read by the id its
10
+ * row gave, never found again by a path or through the session's memo of
11
+ * lookups. A listing refused, one cut short, or a row that cannot be
12
+ * placed fails the copy before anything is written; each file's bytes are
13
+ * then read by the id that walk gave it, on the same client. Each source
14
+ * folder's names are settled as it is read, before anything is written: a
15
+ * holder listed twice is one, and a name distinct holders share (two
16
+ * files, a folder and a file) is refused and said, and nothing is copied
17
+ * for it, nor below it.
18
+ *
19
+ * Every destination folder is proved whole once, fresh on the copy's one
20
+ * client (`folderHolders_prove`), and each child the copy would write into
21
+ * it is refused when that proof names something at its name: it is said,
22
+ * and nothing is uploaded, moved or deleted for it (a folder refused takes
23
+ * what the source holds below it along). A child free by the proof is
24
+ * written create-only (`file_createProved`, `HolderClient.folder_create`):
25
+ * one that arrives between the proof and the write is not written over. A
26
+ * link in the source is said and not copied. A folder whose making CUBE did
27
+ * not answer, though one is there after, may not be the copy's: it is
28
+ * taken as held, and what the source holds below it is skipped and said.
29
+ *
30
+ * Key components:
31
+ * - SourceEntry: one entry of a source read whole: where it is below the source, what it is, its id.
32
+ * - SourceFolder: a folder of a source, by its id, its path and its name below the source.
33
+ * - SourceTwin, SourceTree: a name distinct holders share in a source, and a source read whole.
34
+ * - sourceTree_walk: read a proved source folder whole, recursively, by id.
35
+ * - files_copyTree: copy a folder into a destination path, create-only.
36
+ * - path_copy: the native mount's `cp`, on proof of the source and the destination.
37
+ *
38
+ * Typical usage:
39
+ * ```ts
40
+ * const copied: VfsOutcome = await files_copyTree('/home/ada/study', '/home/ada/study-copy');
41
+ * ```
42
+ *
43
+ * Dependencies: the proofs of `./proof.js` (and its placing of a listing
44
+ * read by id), the folder a copy goes into of `./copyFolder.js` (proved
45
+ * again before a file's bytes are stored), the create-only write of
46
+ * `./replace.js`, and cumin's
47
+ * `chrisIO` (a file's bytes by id, on the bound client; the session's
48
+ * client, bound as a `HolderClient`). Paths are absolute CUBE paths.
49
+ *
50
+ * @module
51
+ */
52
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
53
+ if (k2 === undefined) k2 = k;
54
+ var desc = Object.getOwnPropertyDescriptor(m, k);
55
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
56
+ desc = { enumerable: true, get: function() { return m[k]; } };
57
+ }
58
+ Object.defineProperty(o, k2, desc);
59
+ }) : (function(o, m, k, k2) {
60
+ if (k2 === undefined) k2 = k;
61
+ o[k2] = m[k];
62
+ }));
63
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
64
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
65
+ }) : function(o, v) {
66
+ o["default"] = v;
67
+ });
68
+ var __importStar = (this && this.__importStar) || (function () {
69
+ var ownKeys = function(o) {
70
+ ownKeys = Object.getOwnPropertyNames || function (o) {
71
+ var ar = [];
72
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
73
+ return ar;
74
+ };
75
+ return ownKeys(o);
76
+ };
77
+ return function (mod) {
78
+ if (mod && mod.__esModule) return mod;
79
+ var result = {};
80
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
81
+ __setModuleDefault(result, mod);
82
+ return result;
83
+ };
84
+ })();
85
+ Object.defineProperty(exports, "__esModule", { value: true });
86
+ exports.sourceTree_walk = sourceTree_walk;
87
+ exports.files_copyTree = files_copyTree;
88
+ exports.path_copy = path_copy;
89
+ const path = __importStar(require("path"));
90
+ const cumin_1 = require("@fnndsc/cumin");
91
+ const fond_1 = require("@fnndsc/fond");
92
+ const copyFolder_js_1 = require("./copyFolder.js");
93
+ const move_js_1 = require("./move.js");
94
+ const proof_js_1 = require("./proof.js");
95
+ const replace_js_1 = require("./replace.js");
96
+ /** A folder's three listings, in the order a walk reads them. */
97
+ const SOURCE_LISTS = ['files', 'links', 'dirs'];
98
+ /**
99
+ * Every name a source folder's three listings hold, with its distinct
100
+ * holders: a holder listed twice (the same kind, id and address) is one.
101
+ *
102
+ * @param opened - The folder, opened by its id.
103
+ * @param folderPath - Its path.
104
+ * @returns Each name's holders, in the order the listings named them; null when a listing proved nothing (stacked).
105
+ */
106
+ async function sourceNames_settle(opened, folderPath) {
107
+ const names = new Map();
108
+ for (const asset of SOURCE_LISTS) {
109
+ const placed = await (0, proof_js_1.freshListingRows_place)(opened, asset, folderPath);
110
+ if (!placed.ok)
111
+ return null;
112
+ for (const row of placed.value) {
113
+ const holders = names.get(row.name) ?? [];
114
+ const same = holders.some((one) => one.kind === row.holder.kind && one.id === row.holder.id && one.href === row.holder.href);
115
+ if (!same)
116
+ holders.push(row.holder);
117
+ names.set(row.name, holders);
118
+ }
119
+ }
120
+ return names;
121
+ }
122
+ /**
123
+ * One folder of a source, read whole by its id on the copy's client, its
124
+ * names settled, into the tree, its folders walked in turn by the ids their
125
+ * rows gave (each before what it holds).
126
+ *
127
+ * @param acts - The copy's client.
128
+ * @param folder - The folder.
129
+ * @param tree - Where the entries and the twins go.
130
+ * @returns True when it and everything below it were read whole; false otherwise (stacked).
131
+ */
132
+ async function sourceFolder_walk(acts, folder, tree) {
133
+ const names = await sourceNames_settle(acts.folder_openById(folder.id), folder.path);
134
+ if (names === null)
135
+ return false;
136
+ const inner = [];
137
+ for (const [name, holders] of names) {
138
+ const named = folder.relative === '' ? name : `${folder.relative}/${name}`;
139
+ const sole = holders.length === 1 ? holders[0] : undefined;
140
+ if (sole === undefined) {
141
+ tree.twins.push({ relative: named, holders });
142
+ continue;
143
+ }
144
+ tree.entries.push({ relative: named, kind: sole.kind, id: sole.id });
145
+ if (sole.kind === 'dir')
146
+ inner.push({ id: sole.id, path: path.posix.join(folder.path, name), relative: named });
147
+ }
148
+ for (const below of inner) {
149
+ if (!await sourceFolder_walk(acts, below, tree))
150
+ return false;
151
+ }
152
+ return true;
153
+ }
154
+ /**
155
+ * Reads a proved source folder whole, recursively, by id on the copy's
156
+ * client: its folders, files and links, each listing in full and every row
157
+ * placed, each folder before what it holds, and each folder's names
158
+ * settled (a name distinct holders share is a twin, not an entry).
159
+ *
160
+ * @param acts - The client the source was proved on.
161
+ * @param root - The source folder, by the id its proof gave, and its absolute path.
162
+ * @returns Every entry below it, and every twin; Err when any listing was
163
+ * refused, cut short, or could not be placed (the reason stacked).
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * const walked: Result<SourceTree> = await sourceTree_walk(acts, { id: 7, path: '/home/ada/study' });
168
+ * ```
169
+ */
170
+ async function sourceTree_walk(acts, root) {
171
+ const tree = { entries: [], twins: [] };
172
+ return await sourceFolder_walk(acts, { ...root, relative: '' }, tree) ? { ok: true, value: tree } : { ok: false };
173
+ }
174
+ /**
175
+ * The names a destination folder holds, proved whole once per folder.
176
+ *
177
+ * @param run - The copy.
178
+ * @param folder - The destination folder.
179
+ * @returns The names held (what the copy writes there is added); null when the folder could not be proved (said).
180
+ */
181
+ async function destinationNames_get(run, folder) {
182
+ if (run.held.has(folder))
183
+ return run.held.get(folder) ?? null;
184
+ const proved = await (0, proof_js_1.folderHolders_prove)(run.acts, folder);
185
+ const names = proved.ok ? new Set(proved.value.keys()) : null;
186
+ if (names === null)
187
+ (0, cumin_1.runtimeOutput_err)(` Warning: ${folder} could not be read whole: nothing is copied into it (${cumin_1.errorStack.stack_pop()?.message ?? 'no reason given'})\n`);
188
+ run.held.set(folder, names);
189
+ return names;
190
+ }
191
+ /**
192
+ * Writes one source entry into its place, create-only.
193
+ *
194
+ * @param run - The copy.
195
+ * @param entry - The entry.
196
+ * @param target - Its place in the destination, proved free.
197
+ * @returns Null when written; else why not (said).
198
+ */
199
+ async function entry_write(run, entry, target) {
200
+ if (entry.kind === 'dir') {
201
+ (0, cumin_1.runtimeOutput_data)(` Creating directory: ${target}\n`);
202
+ const made = await run.acts.folder_create(target);
203
+ if (made.ok && made.value === 'made')
204
+ return null;
205
+ const why = made.ok ? (0, copyFolder_js_1.folderNotMade_say)(made.value).slice(2) : 'CUBE refused to make it';
206
+ (0, cumin_1.runtimeOutput_err)(` Warning: Failed to create directory ${target}: ${why}\n`);
207
+ return { errno: made.ok ? 'EEXIST' : 'EIO', cause: why };
208
+ }
209
+ (0, cumin_1.runtimeOutput_data)(` Copying file: ${path.posix.basename(entry.relative)}\n`);
210
+ const bytes = await cumin_1.chrisIO.file_download(entry.id, run.acts.client);
211
+ const written = bytes !== null && await (0, replace_js_1.file_createProved)(run.acts, target, new Blob([new Uint8Array(bytes)]));
212
+ if (written)
213
+ return null;
214
+ const why = bytes === null ? `its content (ID ${String(entry.id)}) could not be read` : cumin_1.errorStack.stack_pop()?.message ?? 'no reason given';
215
+ (0, cumin_1.runtimeOutput_err)(` Warning: Failed to copy file ${entry.relative} to ${target}: ${why}\n`);
216
+ return { errno: 'EIO', cause: why };
217
+ }
218
+ /**
219
+ * Places one source entry, unless the copy's check refuses its path, its
220
+ * folder could not be read whole, or its name is held there.
221
+ *
222
+ * @param run - The copy.
223
+ * @param entry - The entry.
224
+ * @param target - Its place in the destination.
225
+ * @returns Null when written; else why not (said).
226
+ */
227
+ async function entry_place(run, entry, target) {
228
+ if (entry.kind === 'link') {
229
+ (0, cumin_1.runtimeOutput_err)(` Warning: ${entry.relative} is a link, and a link is not copied\n`);
230
+ return { errno: 'EPERM', cause: 'a link, and a link is not copied' };
231
+ }
232
+ const allowed = run.root.finalPath_check?.(target) ?? (0, fond_1.vfs_ok)(true);
233
+ if (!allowed.ok) {
234
+ const why = allowed.reason ?? (0, fond_1.errno_words)(allowed.errno);
235
+ (0, cumin_1.runtimeOutput_err)(` Warning: ${target} is not copied: ${why}\n`);
236
+ return { errno: allowed.errno, cause: why };
237
+ }
238
+ const names = await destinationNames_get(run, path.posix.dirname(target));
239
+ if (names === null)
240
+ return { errno: 'EIO', cause: 'its folder could not be read whole' };
241
+ const name = path.posix.basename(target);
242
+ if (names.has(name)) {
243
+ (0, cumin_1.runtimeOutput_err)(` Warning: ${target} is already held: nothing is copied onto it${entry.kind === 'dir' ? ', nor into it' : ''}\n`);
244
+ return { errno: 'EEXIST', cause: 'already held' };
245
+ }
246
+ const refused = await entry_write(run, entry, target);
247
+ if (refused === null)
248
+ names.add(name);
249
+ return refused;
250
+ }
251
+ /**
252
+ * Copies one source entry, unless it lies below a folder that was not copied.
253
+ *
254
+ * @param run - The copy.
255
+ * @param entry - The entry.
256
+ */
257
+ async function entry_copy(run, entry) {
258
+ if (run.skipped.some((above) => entry.relative.startsWith(`${above}/`))) {
259
+ run.untried++;
260
+ return;
261
+ }
262
+ const refused = await entry_place(run, entry, path.posix.join(run.root.path, entry.relative));
263
+ if (refused === null) {
264
+ run.copied++;
265
+ return;
266
+ }
267
+ run.failed++;
268
+ run.first ??= { relative: entry.relative, ...refused };
269
+ if (entry.kind === 'dir')
270
+ run.skipped.push(entry.relative);
271
+ }
272
+ /**
273
+ * What a proof found, in words.
274
+ *
275
+ * @param proof - The proof.
276
+ * @returns `nothing`, `a file`, or the holders that share the path.
277
+ */
278
+ function proofHolders_say(proof) {
279
+ if (proof.kind === 'absent')
280
+ return 'nothing';
281
+ return proof.kind === 'held' ? `a ${proof.holder.kind}` : (0, proof_js_1.holders_describe)(proof.holders);
282
+ }
283
+ /**
284
+ * Whether a path still holds what its first proof found: still nothing, or
285
+ * the same one holder.
286
+ *
287
+ * @param first - The first proof.
288
+ * @param now - The proof made again.
289
+ * @returns True when they agree.
290
+ */
291
+ function proof_holds(first, now) {
292
+ if (first.kind === 'absent' || now.kind !== 'held')
293
+ return first.kind === now.kind;
294
+ return first.kind === 'held' && first.holder.kind === now.holder.kind && first.holder.id === now.holder.id;
295
+ }
296
+ /**
297
+ * Proves again, once the source is read and before anything is written, the
298
+ * folder the copy's root goes into and what holds the root's name, each by a
299
+ * whole proof through its own parent. A folder gone there meanwhile would be
300
+ * made again by the first folder the copy makes; a name taken, or shared
301
+ * with a folder to merge into, is no longer what the first proof found.
302
+ *
303
+ * @param acts - The copy's client.
304
+ * @param root - The folder the copy becomes, and its first proof.
305
+ * @returns True when both stand as first proved; false otherwise (stacked).
306
+ */
307
+ async function destinationRoot_reprove(acts, root) {
308
+ const parent = path.posix.dirname(root.path);
309
+ const above = await (0, proof_js_1.pathHolders_answer)(parent, acts);
310
+ if (above.kind === 'error')
311
+ return false;
312
+ if (above.kind !== 'held' || above.holder.kind !== 'dir') {
313
+ cumin_1.errorStack.stack_push('error', `copy: ${parent} is no folder to copy into once the source was read (${proofHolders_say(above)} there): nothing was copied`);
314
+ return false;
315
+ }
316
+ const now = await (0, proof_js_1.pathHolders_answer)(root.path, acts);
317
+ if (now.kind === 'error')
318
+ return false;
319
+ if (proof_holds(root.proof, now))
320
+ return true;
321
+ cumin_1.errorStack.stack_push('error', root.proof.kind === 'absent'
322
+ ? `copy: ${root.path} was proved free, and ${proofHolders_say(now)} turned up there while the source was read: nothing was copied`
323
+ : `copy: ${root.path} was a folder to copy into, and could not be proved one once the source was read (${proofHolders_say(now)} there): nothing was copied`);
324
+ return false;
325
+ }
326
+ /**
327
+ * The destination folder a copy becomes, on its first proof: taken as it
328
+ * is when a folder was there (a merge), made when nothing was. That proof
329
+ * holds across the walk of the source, proved again through the folder it
330
+ * goes into before anything is written: a folder that turns up at a root
331
+ * proved free (CUBE answers that one was there, or that one is there and
332
+ * who made it is not known) refuses the copy, and nothing is written.
333
+ *
334
+ * @param acts - The copy's client.
335
+ * @param root - The folder it becomes, and its first proof.
336
+ * @returns True when a folder is there to copy into; false otherwise (stacked).
337
+ */
338
+ async function destinationRoot_settle(acts, root) {
339
+ const there = root.proof;
340
+ const merge = there.kind === 'held' && there.holder.kind === 'dir';
341
+ if (!merge && there.kind !== 'absent') {
342
+ cumin_1.errorStack.stack_push('error', `Destination exists: ${root.path} is held by ${proofHolders_say(there)}; nothing was copied`);
343
+ return false;
344
+ }
345
+ if (!await destinationRoot_reprove(acts, root))
346
+ return false;
347
+ if (merge)
348
+ return true;
349
+ const made = await acts.folder_create(root.path);
350
+ if (!made.ok)
351
+ return false;
352
+ if (made.value === 'made')
353
+ return true;
354
+ cumin_1.errorStack.stack_push('error', made.value === 'present'
355
+ ? `copy: ${root.path}${(0, copyFolder_js_1.folderNotMade_say)('present')}`
356
+ : `copy: ${root.path} was proved free, and a folder turned up there before the copy made it: nothing was copied`);
357
+ return false;
358
+ }
359
+ /**
360
+ * Copies a proved folder into a destination folder, create-only, on a
361
+ * bound client: the source read whole first, then the destination's root
362
+ * settled on its first proof (a folder there for a merge proved again),
363
+ * then each entry. A shortfall is said whole:
364
+ * the first entry refused and why, how many, and how many were not tried.
365
+ *
366
+ * @param acts - The client every proof and write goes to.
367
+ * @param src - The source folder, by the id its proof gave, and its path.
368
+ * @param root - The folder it becomes, its first proof, and the check of each path written.
369
+ * @returns Null when every entry was copied; else the errno of the first
370
+ * entry refused (`EIO` when nothing could be begun), the shortfall stacked.
371
+ */
372
+ async function tree_copy(acts, src, root) {
373
+ const walked = await sourceTree_walk(acts, src);
374
+ if (!walked.ok) {
375
+ cumin_1.errorStack.stack_push('error', `copy: ${src.path} could not be read whole: nothing was copied`);
376
+ return 'EIO';
377
+ }
378
+ if (!await destinationRoot_settle(acts, root))
379
+ return 'EIO';
380
+ const run = { acts, root, held: new Map(), skipped: [], copied: 0, failed: 0, untried: 0, first: null };
381
+ // A folder proved there for a merge is proved again once the source is read: one gone meanwhile takes nothing, an empty source included.
382
+ if (root.proof.kind === 'held' && await destinationNames_get(run, root.path) === null) {
383
+ cumin_1.errorStack.stack_push('error', `copy: ${root.path} was a folder to copy into, and could not be proved one once the source was read: nothing was copied`);
384
+ return 'EIO';
385
+ }
386
+ for (const twin of walked.value.twins) {
387
+ (0, cumin_1.runtimeOutput_err)(` Warning: ${(0, proof_js_1.holders_describe)(twin.holders)} share ${path.posix.join(src.path, twin.relative)}: nothing is copied for that name\n`);
388
+ run.failed++;
389
+ run.first ??= { relative: twin.relative, cause: `${(0, proof_js_1.holders_describe)(twin.holders)} share it`, errno: 'EPERM' };
390
+ }
391
+ for (const entry of walked.value.entries)
392
+ await entry_copy(run, entry);
393
+ (0, cumin_1.runtimeOutput_data)(`Copied ${String(run.copied)} items, ${String(run.failed)} failed\n`);
394
+ if (run.failed === 0)
395
+ return null;
396
+ const total = walked.value.entries.length + walked.value.twins.length;
397
+ cumin_1.errorStack.stack_push('error', (0, fond_1.copyShortfall_say)(root.path, { total, failed: run.failed, untried: run.untried, first: run.first === null ? null : { relative: run.first.relative, cause: run.first.cause } }));
398
+ return run.first?.errno ?? 'EIO';
399
+ }
400
+ /**
401
+ * Recursively copies a folder to a destination path within ChRIS,
402
+ * create-only: the source proved one folder, fresh, and the destination's
403
+ * root proved before the source is read whole by id; each destination
404
+ * folder proved whole once, and each child whose name is held there
405
+ * refused and said.
406
+ *
407
+ * @param srcPath - The source folder's path.
408
+ * @param destPath - The folder it becomes (made when nothing holds it; a folder there is copied into).
409
+ * @param options - The check asked of every path the copy writes, its root first.
410
+ * @returns Done when every entry was copied; else the errno and why (a
411
+ * check's own refusal, `EXDEV` or `EINVAL`, as it gave it).
412
+ *
413
+ * @example
414
+ * ```ts
415
+ * const copied: VfsOutcome = await files_copyTree('/home/ada/study', '/home/ada/study-copy');
416
+ * ```
417
+ */
418
+ async function files_copyTree(srcPath, destPath, options = {}) {
419
+ const src = path.posix.resolve('/', srcPath);
420
+ const dest = path.posix.resolve('/', destPath);
421
+ const self = copyIntoSelf_refuse(src, dest, 'dir');
422
+ if (self !== null)
423
+ return self;
424
+ const acts = await (0, copyFolder_js_1.copyClient_bind)(destPath);
425
+ if (acts === null)
426
+ return (0, fond_1.vfs_failFromStack)('EIO');
427
+ const source = copySource_settle(await (0, proof_js_1.pathHolders_answer)(src, acts), src, true);
428
+ if (!source.ok)
429
+ return source.reason === undefined ? (0, fond_1.vfs_fail)(source.errno, `Source could not be proved one folder: ${src}`) : source;
430
+ if (source.value.kind !== 'dir')
431
+ return (0, fond_1.vfs_fail)('ENOTDIR', `Source is not a folder: ${src}`);
432
+ const there = await (0, proof_js_1.pathHolders_answer)(dest, acts);
433
+ if (there.kind === 'error')
434
+ return (0, fond_1.vfs_failFromStack)(there.notDirectory ? 'ENOTDIR' : 'EIO');
435
+ const allowed = options.finalPath_check?.(dest) ?? (0, fond_1.vfs_ok)(true);
436
+ if (!allowed.ok)
437
+ return allowed.reason === undefined ? (0, fond_1.vfs_fail)(allowed.errno, `copy: ${dest}: ${(0, fond_1.errno_words)(allowed.errno)}`) : allowed;
438
+ const refused = await tree_copy(acts, { id: source.value.id, path: src }, { path: dest, proof: there, ...rootCheck_bind(options) });
439
+ return refused === null ? (0, fond_1.vfs_ok)(true) : (0, fond_1.vfs_failFromStack)(refused);
440
+ }
441
+ /**
442
+ * The refusal of a copy whose final path is its source, or, for a folder,
443
+ * lies inside it: compared on the paths the copy was given, before anything
444
+ * is read or written.
445
+ *
446
+ * @param src - The source's absolute path.
447
+ * @param final - The copy's own path.
448
+ * @param kind - What the source is.
449
+ * @returns `EINVAL` with the words, or null when the copy may go there.
450
+ */
451
+ function copyIntoSelf_refuse(src, final, kind) {
452
+ if (final !== src && (kind !== 'dir' || !(0, move_js_1.destination_isWithin)(src, final)))
453
+ return null;
454
+ return (0, fond_1.vfs_fail)('EINVAL', `cannot copy ${src} to ${final}: a destination inside what is copied`);
455
+ }
456
+ /**
457
+ * The check a copy's root carries, when one was given.
458
+ *
459
+ * @param options - The copy's options.
460
+ * @returns The check as a root's, or nothing.
461
+ */
462
+ function rootCheck_bind(options) {
463
+ const given = options.finalPath_check;
464
+ if (given === undefined)
465
+ return {};
466
+ return {
467
+ finalPath_check(final) {
468
+ return given(final);
469
+ },
470
+ };
471
+ }
472
+ /**
473
+ * Copies one proved file to a path, create-only. The folder the copy was
474
+ * chosen to go into, when it was, is proved one folder again once the bytes
475
+ * are read and before they are stored: one gone meanwhile would be made
476
+ * again by the store.
477
+ *
478
+ * @param acts - The copy's client.
479
+ * @param source - The file, as its proof named it.
480
+ * @param dest - Its new path.
481
+ * @param into - The folder the copy was chosen to go into, proved one; null when `dest` was the copy's own path as asked.
482
+ * @returns What was stored, or why not (`EEXIST` a file there; `ENOENT`,
483
+ * `ENOTDIR`, `EPERM` for the folder it goes into no longer one; `EISDIR`, `EIO`).
484
+ */
485
+ async function fileHolder_copy(acts, source, dest, into = null) {
486
+ const bytes = await cumin_1.chrisIO.file_download(source.id, acts.client);
487
+ if (bytes === null)
488
+ return (0, fond_1.vfs_fail)('EIO', `the source file (ID ${String(source.id)}) could not be read`);
489
+ const still = into === null ? (0, fond_1.vfs_ok)(true) : await (0, copyFolder_js_1.copyFolder_proveOn)(acts, into);
490
+ if (!still.ok)
491
+ return (0, fond_1.vfs_fail)(still.errno, `copy: ${still.reason ?? `${into ?? dest} is not a folder to copy into`} once the source was read: nothing was copied`);
492
+ // A copy into a folder never makes it: one gone by the time the store
493
+ // proves its own path refuses, where a free path would make it again.
494
+ return (0, replace_js_1.file_store)(acts, dest, new Blob([new Uint8Array(bytes)]), 'refuse', into !== null);
495
+ }
496
+ /**
497
+ * The source of a copy, proved: one file, or (recursively) one folder.
498
+ *
499
+ * @param proof - What holds the source.
500
+ * @param src - Its path.
501
+ * @param recursive - Whether a folder may be copied.
502
+ * @returns The holder, or why it is not copied.
503
+ */
504
+ function copySource_settle(proof, src, recursive) {
505
+ if (proof.kind === 'error')
506
+ return (0, fond_1.vfs_failFromStack)(proof.notDirectory ? 'ENOTDIR' : 'EIO');
507
+ if (proof.kind === 'absent')
508
+ return (0, fond_1.vfs_fail)('ENOENT', `Source not found: ${src}`);
509
+ if (proof.kind === 'ambiguous')
510
+ return (0, fond_1.vfs_fail)('EPERM', `${(0, proof_js_1.holders_describe)(proof.holders)} share ${src}, and neither is copied`);
511
+ if (proof.holder.kind === 'link')
512
+ return (0, fond_1.vfs_fail)('EPERM', `${src} is a link, and a link is not copied`);
513
+ if (proof.holder.kind === 'dir' && !recursive)
514
+ return (0, fond_1.vfs_fail)('EISDIR', `Source is a directory. Re-run with --recursive to copy: ${src}`);
515
+ return (0, fond_1.vfs_ok)(proof.holder);
516
+ }
517
+ /**
518
+ * The one place a copy's final path is chosen: into a destination proved
519
+ * one folder, under the name asked (one component, directly inside it) or
520
+ * the source's own; otherwise the destination is the copy's own path. A
521
+ * destination that must be a folder and is not is refused: `ENOENT` for
522
+ * nothing there, `ENOTDIR` for a file or a link, `EPERM` for several.
523
+ *
524
+ * @param acts - The copy's client.
525
+ * @param src - The source's path.
526
+ * @param dest - The destination as asked.
527
+ * @param options - Whether a folder is required there, and the name.
528
+ * @returns The final path and its proof, or why the copy may not be made.
529
+ */
530
+ async function copyTarget_settle(acts, src, dest, options) {
531
+ const there = await (0, proof_js_1.pathHolders_answer)(dest, acts);
532
+ if (there.kind === 'error')
533
+ return (0, fond_1.vfs_failFromStack)(there.notDirectory ? 'ENOTDIR' : 'EIO');
534
+ if (there.kind === 'held' && there.holder.kind === 'dir')
535
+ return folderTarget_settle(acts, src, dest, options);
536
+ if (there.kind === 'ambiguous')
537
+ return (0, fond_1.vfs_fail)('EPERM', `${(0, proof_js_1.holders_describe)(there.holders)} share ${dest}: nothing was copied`);
538
+ if (options.intoFolder !== true)
539
+ return (0, fond_1.vfs_ok)({ final: dest, proof: there, into: null });
540
+ return folderMissing_refuse(there, dest);
541
+ }
542
+ /**
543
+ * A copy's final path inside a destination proved one folder: under the
544
+ * name asked, or the source's own, directly inside it, and proved there.
545
+ *
546
+ * @param acts - The copy's client.
547
+ * @param src - The source's path.
548
+ * @param dest - The destination folder.
549
+ * @param options - The name the copy takes in a folder.
550
+ * @returns The final path and its proof, or why the copy may not be made.
551
+ */
552
+ async function folderTarget_settle(acts, src, dest, options) {
553
+ const final = (0, fond_1.childPath_join)(dest, options.name ?? path.posix.basename(src));
554
+ if (!final.ok)
555
+ return final;
556
+ const inside = await (0, proof_js_1.pathHolders_answer)(final.value, acts);
557
+ if (inside.kind === 'error')
558
+ return (0, fond_1.vfs_failFromStack)(inside.notDirectory ? 'ENOTDIR' : 'EIO');
559
+ return (0, fond_1.vfs_ok)({ final: final.value, proof: inside, into: dest });
560
+ }
561
+ /**
562
+ * The refusal of a copy into a destination that must be one folder and is
563
+ * not: `ENOENT` for nothing there, `ENOTDIR` for what is there instead.
564
+ *
565
+ * @param there - The destination's proof: nothing, or one holder that is no folder.
566
+ * @param dest - The destination.
567
+ * @returns The refusal.
568
+ */
569
+ function folderMissing_refuse(there, dest) {
570
+ return there.kind === 'absent'
571
+ ? (0, fond_1.vfs_fail)('ENOENT', `${dest}: no folder is there to copy into; nothing was copied`)
572
+ : (0, fond_1.vfs_fail)('ENOTDIR', `${dest} is a ${there.holder.kind === 'dir' ? 'folder' : there.holder.kind}, not a folder to copy into; nothing was copied`);
573
+ }
574
+ /**
575
+ * Copies what holds a path (the native mount's `cp`): the source and the
576
+ * destination proved on one client, the final path chosen once
577
+ * ({@link copyTarget_settle}), never inside what is copied (`EINVAL`), and
578
+ * asked of the dispatcher's check before anything is written. A file is
579
+ * stored create-only (a file there is `EEXIST`); a folder is copied with
580
+ * {@link files_copyTree}'s rules, its root's first proof carried
581
+ * through the walk of the source.
582
+ *
583
+ * @param src - The source's absolute path.
584
+ * @param dest - The destination's absolute path.
585
+ * @param options - Whether a folder may be copied, whether the destination
586
+ * must be one folder, the name the copy takes in a folder, and the check
587
+ * of each path written.
588
+ * @returns Done, or why not.
589
+ *
590
+ * @example
591
+ * ```ts
592
+ * const copied: VfsOutcome = await path_copy('/home/ada/a.txt', '/home/ada/docs', { recursive: false });
593
+ * ```
594
+ */
595
+ async function path_copy(src, dest, options) {
596
+ const named = (0, fond_1.entryName_check)(options.name ?? path.posix.basename(src));
597
+ if (options.name !== undefined && !named.ok)
598
+ return named;
599
+ const acts = await (0, copyFolder_js_1.copyClient_bind)(dest);
600
+ if (acts === null)
601
+ return (0, fond_1.vfs_failFromStack)('EIO');
602
+ const source = copySource_settle(await (0, proof_js_1.pathHolders_answer)(src, acts), src, options.recursive === true);
603
+ if (!source.ok)
604
+ return source;
605
+ const target = await copyTarget_settle(acts, src, dest, options);
606
+ if (!target.ok)
607
+ return target;
608
+ const { final, proof, into } = target.value;
609
+ const allowed = copyIntoSelf_refuse(src, final, source.value.kind) ?? options.finalPath_check?.(final) ?? (0, fond_1.vfs_ok)(true);
610
+ if (!allowed.ok)
611
+ return allowed;
612
+ if (source.value.kind === 'dir') {
613
+ const refused = await tree_copy(acts, { id: source.value.id, path: src }, { path: final, proof, ...rootCheck_bind(options) });
614
+ return refused === null ? (0, fond_1.vfs_ok)(true) : (0, fond_1.vfs_failFromStack)(refused);
615
+ }
616
+ return fileCopy_settle(await fileHolder_copy(acts, source.value, final, into), final);
617
+ }
618
+ /**
619
+ * What one file's create-only copy came to, as `cp` says it: a file at the
620
+ * final path is `EEXIST` in words of its own (the store's reason dropped),
621
+ * any other failure its own reason or the stack's.
622
+ *
623
+ * @param copied - The store's outcome.
624
+ * @param final - The copy's final path.
625
+ * @returns Done, or why not.
626
+ */
627
+ function fileCopy_settle(copied, final) {
628
+ if (copied.ok)
629
+ return (0, fond_1.vfs_ok)(true);
630
+ if (copied.errno === 'EEXIST') {
631
+ cumin_1.errorStack.stack_pop();
632
+ return (0, fond_1.vfs_fail)('EEXIST', `Destination exists: ${final} — mise cannot overwrite a file; remove it first`);
633
+ }
634
+ return copied.reason !== undefined ? copied : (0, fond_1.vfs_failFromStack)(copied.errno);
635
+ }
636
+ //# sourceMappingURL=copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../src/files/copy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuJH,0CAGC;AAu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