@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,60 @@
1
+ /**
2
+ * @file Where a jump target lands in the /proc tree.
3
+ *
4
+ * Names what a jump target means (a feed, a node, or a bare number that may
5
+ * be either) and finds every place it lands that this identity can see,
6
+ * asking CUBE live for what the roster and the index lack.
7
+ *
8
+ * Key components:
9
+ * - procTarget_parse: what a target names.
10
+ * - procTarget_locate, ProcLocation: where it lands.
11
+ *
12
+ * Typical usage:
13
+ * ```typescript
14
+ * const places: ProcLocation[] = await procTarget_locate('feed_4389');
15
+ * ```
16
+ *
17
+ * Dependencies: `@fnndsc/cumin` (cache, plugin-instance read), `./feedIndex`.
18
+ *
19
+ * @module
20
+ */
21
+ /**
22
+ * One place a jump can land: a feed, or a node within one.
23
+ *
24
+ * @property kind - A feed, or a node (plugin instance).
25
+ * @property feedId - The feed, or the node's feed.
26
+ * @property nodeId - The node, for a node.
27
+ * @property name - The `/proc` name: `feed_4389`, or `pl-dicom_repack_639204`.
28
+ * @property title - The feed's title.
29
+ */
30
+ export interface ProcLocation {
31
+ kind: 'feed' | 'node';
32
+ feedId: number;
33
+ nodeId?: number;
34
+ name: string;
35
+ title: string;
36
+ }
37
+ /**
38
+ * What a jump target names: a feed only (`feed_4389`), a node only
39
+ * (`pl-dicom_repack_639204`, or `_639204`), or a bare number that may be
40
+ * either. Null for anything else.
41
+ *
42
+ * @param target - What the operator typed.
43
+ * @returns The id and which kinds it may name, or null.
44
+ */
45
+ export declare function procTarget_parse(target: string): {
46
+ id: number;
47
+ feed: boolean;
48
+ node: boolean;
49
+ } | null;
50
+ /**
51
+ * Finds where a jump target lands, asking CUBE live for what the roster
52
+ * and the index lack: a feed shared since the roster was walked, or a node
53
+ * in one. A node's feed is adopted into the roster on the way, so the
54
+ * place the answer names can be entered at once. A bare number that is
55
+ * both a feed and a node answers both; the caller asks which.
56
+ *
57
+ * @param target - A feed id, a node id, or a `feed_N` / `<plugin>_N` name.
58
+ * @returns Every place it names that this identity can see; empty for none.
59
+ */
60
+ export declare function procTarget_locate(target: string): Promise<ProcLocation[]>;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ /**
3
+ * @file Where a jump target lands in the /proc tree.
4
+ *
5
+ * Names what a jump target means (a feed, a node, or a bare number that may
6
+ * be either) and finds every place it lands that this identity can see,
7
+ * asking CUBE live for what the roster and the index lack.
8
+ *
9
+ * Key components:
10
+ * - procTarget_parse: what a target names.
11
+ * - procTarget_locate, ProcLocation: where it lands.
12
+ *
13
+ * Typical usage:
14
+ * ```typescript
15
+ * const places: ProcLocation[] = await procTarget_locate('feed_4389');
16
+ * ```
17
+ *
18
+ * Dependencies: `@fnndsc/cumin` (cache, plugin-instance read), `./feedIndex`.
19
+ *
20
+ * @module
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.procTarget_parse = procTarget_parse;
24
+ exports.procTarget_locate = procTarget_locate;
25
+ const cumin_1 = require("@fnndsc/cumin");
26
+ const feedIndex_js_1 = require("./feedIndex.js");
27
+ /**
28
+ * What a jump target names: a feed only (`feed_4389`), a node only
29
+ * (`pl-dicom_repack_639204`, or `_639204`), or a bare number that may be
30
+ * either. Null for anything else.
31
+ *
32
+ * @param target - What the operator typed.
33
+ * @returns The id and which kinds it may name, or null.
34
+ */
35
+ function procTarget_parse(target) {
36
+ const text = target.trim();
37
+ const feed = /^feed_(\d+)$/.exec(text);
38
+ if (feed !== null)
39
+ return { id: Number(feed[1]), feed: true, node: false };
40
+ const node = /^[\w.-]*_(\d+)$/.exec(text);
41
+ if (node !== null)
42
+ return { id: Number(node[1]), feed: false, node: true };
43
+ if (/^\d+$/.test(text))
44
+ return { id: Number(text), feed: true, node: true };
45
+ return null;
46
+ }
47
+ /**
48
+ * Finds where a jump target lands, asking CUBE live for what the roster
49
+ * and the index lack: a feed shared since the roster was walked, or a node
50
+ * in one. A node's feed is adopted into the roster on the way, so the
51
+ * place the answer names can be entered at once. A bare number that is
52
+ * both a feed and a node answers both; the caller asks which.
53
+ *
54
+ * @param target - A feed id, a node id, or a `feed_N` / `<plugin>_N` name.
55
+ * @returns Every place it names that this identity can see; empty for none.
56
+ */
57
+ async function procTarget_locate(target) {
58
+ const parsed = procTarget_parse(target);
59
+ if (parsed === null)
60
+ return [];
61
+ const cache = (0, cumin_1.procCache_get)();
62
+ const found = [];
63
+ if (parsed.feed) {
64
+ const feed = cache.feed_get(parsed.id) ?? (await (0, feedIndex_js_1.procFeedAbsent_probe)(parsed.id));
65
+ if (feed !== null)
66
+ found.push({ kind: 'feed', feedId: feed.id, name: `feed_${feed.id}`, title: feed.title });
67
+ }
68
+ if (parsed.node) {
69
+ const node = await procNode_find(parsed.id);
70
+ if (node !== null) {
71
+ const feed = cache.feed_get(node.feedId) ?? (await (0, feedIndex_js_1.procFeedAbsent_probe)(node.feedId));
72
+ if (feed !== null) {
73
+ found.push({ kind: 'node', feedId: node.feedId, nodeId: parsed.id, name: `${node.pluginName}_${parsed.id}`, title: feed.title });
74
+ }
75
+ }
76
+ }
77
+ return found;
78
+ }
79
+ /**
80
+ * A node's feed and plugin, from the index or, when the index lacks it,
81
+ * from CUBE.
82
+ *
83
+ * @param nodeId - The plugin instance id.
84
+ * @returns Its feed and plugin name, or null when CUBE shows no such node to this identity.
85
+ */
86
+ async function procNode_find(nodeId) {
87
+ const known = (0, cumin_1.procCache_get)().instance_get(nodeId);
88
+ if (known !== undefined)
89
+ return { feedId: known.feedID, pluginName: known.pluginName };
90
+ const client = await cumin_1.chrisConnection.client_get();
91
+ if (!client)
92
+ return null;
93
+ try {
94
+ const handle = await (0, cumin_1.pluginInstance_get)(client, nodeId);
95
+ const feedId = Number(handle?.data?.feed_id);
96
+ const pluginName = String(handle?.data?.plugin_name ?? '');
97
+ return Number.isFinite(feedId) && feedId > 0 && pluginName !== '' ? { feedId, pluginName } : null;
98
+ }
99
+ catch {
100
+ return null;
101
+ }
102
+ }
103
+ //# sourceMappingURL=locate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locate.js","sourceRoot":"","sources":["../../../../src/vfs/providers/proc/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,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;IACvF,MAAM,MAAM,GAAG,MAAM,uBAAe,CAAC,UAAU,EAAE,CAAC;IAClD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC;QACH,MAAM,MAAM,GAAgC,MAAM,IAAA,0BAAkB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrF,MAAM,MAAM,GAAW,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,UAAU,GAAW,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACpG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @file The /proc path grammar.
3
+ *
4
+ * Names the parts of a `/proc/jobs/...` path: the feed, the job, the
5
+ * virtual file, and the remainder beneath a job's `data` link. Both the
6
+ * provider and the reading of the tree (a path naming one feed needs that
7
+ * feed alone) parse paths with it.
8
+ *
9
+ * Key components:
10
+ * - PROC_JOBS_PREFIX: the mount point.
11
+ * - INSTANCE_FILES, FEED_FILES: the virtual files in a job's and a feed's folder.
12
+ * - procPath_parse: a path's feed, job, virtual file and data remainder.
13
+ *
14
+ * Typical usage:
15
+ * ```typescript
16
+ * const { feedID, instanceID } = procPath_parse('/proc/jobs/feed_7/pl-dircopy_12');
17
+ * ```
18
+ *
19
+ * Dependencies: none.
20
+ *
21
+ * @module
22
+ */
23
+ /** Virtual filenames inside each instance directory. */
24
+ export declare const INSTANCE_FILES: ReadonlySet<string>;
25
+ /** Virtual filenames inside each feed directory. */
26
+ export declare const FEED_FILES: ReadonlySet<string>;
27
+ /** Where the jobs tree is mounted. */
28
+ export declare const PROC_JOBS_PREFIX: string;
29
+ /**
30
+ * Parses a `/proc/jobs` path into the feed, job and virtual file it names.
31
+ *
32
+ * @param pathStr - An absolute `/proc/jobs/...` path, without a trailing slash.
33
+ * @returns The feed id, the job id, the virtual file, and the remainder below
34
+ * a job's `data` link; each null when the path does not name one.
35
+ *
36
+ * @example
37
+ * procPath_parse('/proc/jobs/feed_7/pl-dircopy_12/status');
38
+ * // { feedID: 7, instanceID: 12, virtualFile: 'status', dataRemainder: null }
39
+ */
40
+ export declare function procPath_parse(pathStr: string): {
41
+ feedID: number | null;
42
+ instanceID: number | null;
43
+ virtualFile: string | null;
44
+ /**
45
+ * Set when the path descends THROUGH an instance's `data` link: the
46
+ * portion after `data`, '' for the link itself. Everything under the
47
+ * link belongs to the link's CFS target, not to `/proc`.
48
+ */
49
+ dataRemainder: string | null;
50
+ };
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * @file The /proc path grammar.
4
+ *
5
+ * Names the parts of a `/proc/jobs/...` path: the feed, the job, the
6
+ * virtual file, and the remainder beneath a job's `data` link. Both the
7
+ * provider and the reading of the tree (a path naming one feed needs that
8
+ * feed alone) parse paths with it.
9
+ *
10
+ * Key components:
11
+ * - PROC_JOBS_PREFIX: the mount point.
12
+ * - INSTANCE_FILES, FEED_FILES: the virtual files in a job's and a feed's folder.
13
+ * - procPath_parse: a path's feed, job, virtual file and data remainder.
14
+ *
15
+ * Typical usage:
16
+ * ```typescript
17
+ * const { feedID, instanceID } = procPath_parse('/proc/jobs/feed_7/pl-dircopy_12');
18
+ * ```
19
+ *
20
+ * Dependencies: none.
21
+ *
22
+ * @module
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.PROC_JOBS_PREFIX = exports.FEED_FILES = exports.INSTANCE_FILES = void 0;
26
+ exports.procPath_parse = procPath_parse;
27
+ /** Virtual filenames inside each instance directory. */
28
+ exports.INSTANCE_FILES = new Set(['status', 'params', 'log', 'data']);
29
+ /** Virtual filenames inside each feed directory. */
30
+ exports.FEED_FILES = new Set(['status', 'title', 'note']);
31
+ /** Where the jobs tree is mounted. */
32
+ exports.PROC_JOBS_PREFIX = '/proc/jobs';
33
+ /**
34
+ * Parses a `/proc/jobs` path into the feed, job and virtual file it names.
35
+ *
36
+ * @param pathStr - An absolute `/proc/jobs/...` path, without a trailing slash.
37
+ * @returns The feed id, the job id, the virtual file, and the remainder below
38
+ * a job's `data` link; each null when the path does not name one.
39
+ *
40
+ * @example
41
+ * procPath_parse('/proc/jobs/feed_7/pl-dircopy_12/status');
42
+ * // { feedID: 7, instanceID: 12, virtualFile: 'status', dataRemainder: null }
43
+ */
44
+ function procPath_parse(pathStr) {
45
+ const parts = procRelative_read(pathStr).split('/').filter(Boolean);
46
+ let feedID = null;
47
+ let instanceID = null;
48
+ let virtualFile = null;
49
+ let dataRemainder = null;
50
+ if (parts.length >= 1) {
51
+ const feedMatch = parts[0].match(/^feed_(\d+)$/);
52
+ if (feedMatch)
53
+ feedID = parseInt(feedMatch[1], 10);
54
+ }
55
+ // A `data` segment directly after an instance segment starts the link's
56
+ // subtree: the instance is the one before it, whatever follows is the
57
+ // remainder inside the CFS target.
58
+ for (let index = 2; index < parts.length; index++) {
59
+ if (parts[index] !== 'data')
60
+ continue;
61
+ const inst = segmentInstance_parse(parts[index - 1]);
62
+ if (inst === null)
63
+ continue;
64
+ instanceID = inst;
65
+ virtualFile = 'data';
66
+ dataRemainder = parts.slice(index + 1).join('/');
67
+ return { feedID, instanceID, virtualFile, dataRemainder };
68
+ }
69
+ if (parts.length >= 2) {
70
+ const lastPart = parts[parts.length - 1];
71
+ if (exports.FEED_FILES.has(lastPart) || exports.INSTANCE_FILES.has(lastPart)) {
72
+ virtualFile = lastPart;
73
+ if (parts.length >= 3)
74
+ instanceID = segmentInstance_parse(parts[parts.length - 2]);
75
+ }
76
+ else {
77
+ instanceID = segmentInstance_parse(lastPart);
78
+ }
79
+ }
80
+ return { feedID, instanceID, virtualFile, dataRemainder };
81
+ }
82
+ /**
83
+ * A path below the mount, without the mount: '' for the mount itself, and
84
+ * a path outside it as it stands.
85
+ *
86
+ * @param pathStr - An absolute path, without a trailing slash.
87
+ * @returns The path relative to `/proc/jobs`.
88
+ */
89
+ function procRelative_read(pathStr) {
90
+ if (pathStr === exports.PROC_JOBS_PREFIX)
91
+ return '';
92
+ if (pathStr.startsWith(`${exports.PROC_JOBS_PREFIX}/`))
93
+ return pathStr.slice(exports.PROC_JOBS_PREFIX.length + 1);
94
+ return pathStr;
95
+ }
96
+ /**
97
+ * The job id a path segment names by its `_<id>` suffix (`pl-dircopy_12`).
98
+ *
99
+ * @param segment - One segment of a path.
100
+ * @returns The id, or null when the segment names no job.
101
+ */
102
+ function segmentInstance_parse(segment) {
103
+ const instMatch = segment.match(/_(\d+)$/);
104
+ return instMatch ? parseInt(instMatch[1], 10) : null;
105
+ }
106
+ //# sourceMappingURL=path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../src/vfs/providers/proc/path.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAqBH,wCA8CC;AAjED,wDAAwD;AAC3C,QAAA,cAAc,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAChG,oDAAoD;AACvC,QAAA,UAAU,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpF,sCAAsC;AACzB,QAAA,gBAAgB,GAAW,YAAY,CAAC;AAErD;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAC,OAAe;IAW5C,MAAM,KAAK,GAAa,iBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM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CAAC,EAAE,CAAC;YAC7D,WAAW,GAAG,QAAQ,CAAC;YACvB,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;gBAAE,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,OAAe;IACxC,IAAI,OAAO,KAAK,wBAAgB;QAAE,OAAO,EAAE,CAAC;IAC5C,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,wBAAgB,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC,wBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClG,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,OAAe;IAC5C,MAAM,SAAS,GAA4B,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACpE,OAAO,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @file Feed visits and the roster's sync: the /proc tree's freshness.
3
+ *
4
+ * Every visit is a cheap delta, never a re-crawl. A visit to a loaded feed
5
+ * reads its row, and only when something moved walks the nodes created or
6
+ * finished since its cursor and the ones still running. A visit to the
7
+ * roster reads each collection's newest page and holds its total against
8
+ * the last walk's, promoting itself to the full index walk when a total
9
+ * moved otherwise or the roster has aged.
10
+ *
11
+ * Key components:
12
+ * - feedVisit_sync: one loaded feed brought up to date, visits joined and coalesced.
13
+ * - procRoster_sync, procRoster_syncWithin, procRoster_syncStart: the roster brought up to date.
14
+ * - procRoster_bootSync: a restored roster brought into service at boot.
15
+ *
16
+ * Typical usage:
17
+ * ```typescript
18
+ * await procRoster_syncWithin(ROSTER_LIST_BUDGET_MS);
19
+ * ```
20
+ *
21
+ * Dependencies: `@fnndsc/cumin` (cache, feed and instance list contracts), `./book`, `./rows`,
22
+ * `./feedIndex`, `./catchup`.
23
+ *
24
+ * @module
25
+ */
26
+ import { type ProcRosterSyncKind } from '@fnndsc/cumin';
27
+ /**
28
+ * Brings one already-loaded feed up to date with CUBE at the cost the change
29
+ * warrants: a settled feed pays one feed-row fetch per {@link FEED_RECHECK_MS};
30
+ * a feed with running work pays that fetch on every visit; and only when the
31
+ * counters moved (or work is running) does the visit walk the delta —
32
+ * `min_end_date` from the cursor, which yields nodes created OR finished since
33
+ * (CUBE stamps end_date at creation and again at completion) — followed by an
34
+ * `active=true` sweep for the nodes still in flight.
35
+ *
36
+ * Concurrent visits share one in-flight sync, and visits within
37
+ * {@link FEED_VISIT_COALESCE_MS} of each other share the first one's result
38
+ * (a pane tick and an `ls` in the same second are one visit). Failures are
39
+ * surfaced as warnings and never fail the visit: the cache stays as it was.
40
+ *
41
+ * @param feedID - A feed whose topology is already loaded.
42
+ * @param force - Ignore the settled-feed throttle (an explicit refresh).
43
+ * @returns True when the cache reflects CUBE as of this visit (including a
44
+ * visit that needed no wire), false when the sync failed.
45
+ */
46
+ export declare function feedVisit_sync(feedID: number, force?: boolean): Promise<boolean>;
47
+ /**
48
+ * Brings the feed roster up to date on a `/proc/jobs` visit. While the roster
49
+ * is younger than {@link ROSTER_FULL_WALK_MS} this is a delta: feeds whose id
50
+ * exceeds the highest known one, from both the owned/shared and the public
51
+ * collections (one call each when nothing is new). Once older, it is the full
52
+ * index walk, which is the only way a feed shared later, or one deleted, is
53
+ * seen. A roster still owned by warmup (not yet `current`) is left alone.
54
+ *
55
+ * @param force - Walk the whole index regardless of age.
56
+ * @returns Feed IDs the sync brought in or found changed: after a full
57
+ * walk, the reconciliation targets (new, changed, or active feeds); after
58
+ * a delta, the newly seen feeds. Empty when nothing moved or the roster
59
+ * was left alone.
60
+ */
61
+ export declare function procRoster_sync(force?: boolean): Promise<number[]>;
62
+ /**
63
+ * Waits for the roster's sync at most `budgetMs`: a quick CUBE lands what it
64
+ * found in the answer (a share is seen on the next look), a slow one is left
65
+ * to land behind it, announced as arrivals, and the listing answers from the
66
+ * cache. A listing never waits on CUBE longer than the budget.
67
+ *
68
+ * @param budgetMs - How long the caller may wait.
69
+ *
70
+ * @example
71
+ * await procRoster_syncWithin(ROSTER_LIST_BUDGET_MS);
72
+ */
73
+ export declare function procRoster_syncWithin(budgetMs: number): Promise<void>;
74
+ /**
75
+ * Starts the roster's sync and returns at once. The roster is index
76
+ * movement: a command that lists it answers from the cache now, the walk
77
+ * runs off the session's lane (deduped with any sync in flight), the
78
+ * prompt names it while it runs, and arrivals land as they do today.
79
+ *
80
+ * @param force - Whether to run the full walk regardless of the timer.
81
+ * @returns The walk started or already in flight, or `none` when the cache is not in service.
82
+ */
83
+ export declare function procRoster_syncStart(force?: boolean): ProcRosterSyncKind | 'none';
84
+ /**
85
+ * Brings a restored roster into service at boot without walking the whole
86
+ * feed index: feeds newer than the highest restored id are added (one call
87
+ * per collection when nothing is new), and the cache is marked built so
88
+ * visits can begin. Counters of restored feeds stay as checkpointed until a
89
+ * visit or the full walk the host runs in the background afterwards.
90
+ *
91
+ * @returns The feed IDs added.
92
+ * @throws {Error} When not connected or the roster is empty (nothing was
93
+ * restored) — the host then falls back to the full index build.
94
+ */
95
+ export declare function procRoster_bootSync(): Promise<number[]>;