@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,69 @@
1
+ /**
2
+ * @file The topology catch-up queue of the /proc tree.
3
+ *
4
+ * A feed the roster gains after the sweep — found by the watcher's delta,
5
+ * shared to this identity, or restored from a roster whose shard was never
6
+ * written — has a row but no jobs, so its SIZE and TIME read as dashes
7
+ * until someone opens it (the only thing that walked a feed's jobs). Every
8
+ * roster sync queues the feeds it leaves without topology, and one
9
+ * detached walk at a time lands them: a feed-scoped page or two each, off
10
+ * the lane, annunciated by the load register like a visit's walk.
11
+ *
12
+ * Key components:
13
+ * - procTopologyCatchup_enqueue, procTopologyCatchup_roster: queue feeds, start the walk.
14
+ * - procTopologyCatchup_status, procTopologyCatchup_await: what is queued, and its end.
15
+ * - procTopologyCatchup_reset: forget the queue.
16
+ *
17
+ * Typical usage:
18
+ * ```typescript
19
+ * procTopologyCatchup_enqueue([feedID]);
20
+ * ```
21
+ *
22
+ * Dependencies: `@fnndsc/cumin` (cache), `./book`, `./feedTopology`.
23
+ *
24
+ * @module
25
+ */
26
+ import { type ProcCache } from '@fnndsc/cumin';
27
+ /**
28
+ * Queues roster feeds whose topology the cache lacks, and starts the walk
29
+ * when none is running. Nothing is queued while the global sweep is the
30
+ * one bringing topology in (it covers every feed), nor for a feed already
31
+ * loaded, loading or queued.
32
+ *
33
+ * @param feedIDs - Candidate feed IDs (a sync's arrivals, or the roster).
34
+ * @returns How many feeds this call queued.
35
+ */
36
+ export declare function procTopologyCatchup_enqueue(feedIDs: number[]): number;
37
+ /**
38
+ * How many feeds still wait for their topology, and whether a walk runs.
39
+ *
40
+ * @returns The catch-up's state.
41
+ */
42
+ export declare function procTopologyCatchup_status(): {
43
+ queued: number;
44
+ running: boolean;
45
+ };
46
+ /**
47
+ * Waits for the catch-up to drain (tests, and a readout that wants whole numbers).
48
+ *
49
+ * @returns Resolves when no walk is queued or running.
50
+ */
51
+ export declare function procTopologyCatchup_await(): Promise<void>;
52
+ /**
53
+ * Forgets the queue (a sweep took over, or a cache cleared underneath us).
54
+ *
55
+ * @example
56
+ * procTopologyCatchup_reset();
57
+ */
58
+ export declare function procTopologyCatchup_reset(): void;
59
+ /**
60
+ * Queues every roster feed without topology — what a roster sync leaves
61
+ * behind when the sweep is already over.
62
+ *
63
+ * @param cache - The process cache.
64
+ * @returns How many feeds were queued.
65
+ *
66
+ * @example
67
+ * procTopologyCatchup_roster(procCache_get());
68
+ */
69
+ export declare function procTopologyCatchup_roster(cache: ProcCache): number;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ /**
3
+ * @file The topology catch-up queue of the /proc tree.
4
+ *
5
+ * A feed the roster gains after the sweep — found by the watcher's delta,
6
+ * shared to this identity, or restored from a roster whose shard was never
7
+ * written — has a row but no jobs, so its SIZE and TIME read as dashes
8
+ * until someone opens it (the only thing that walked a feed's jobs). Every
9
+ * roster sync queues the feeds it leaves without topology, and one
10
+ * detached walk at a time lands them: a feed-scoped page or two each, off
11
+ * the lane, annunciated by the load register like a visit's walk.
12
+ *
13
+ * Key components:
14
+ * - procTopologyCatchup_enqueue, procTopologyCatchup_roster: queue feeds, start the walk.
15
+ * - procTopologyCatchup_status, procTopologyCatchup_await: what is queued, and its end.
16
+ * - procTopologyCatchup_reset: forget the queue.
17
+ *
18
+ * Typical usage:
19
+ * ```typescript
20
+ * procTopologyCatchup_enqueue([feedID]);
21
+ * ```
22
+ *
23
+ * Dependencies: `@fnndsc/cumin` (cache), `./book`, `./feedTopology`.
24
+ *
25
+ * @module
26
+ */
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.procTopologyCatchup_enqueue = procTopologyCatchup_enqueue;
29
+ exports.procTopologyCatchup_status = procTopologyCatchup_status;
30
+ exports.procTopologyCatchup_await = procTopologyCatchup_await;
31
+ exports.procTopologyCatchup_reset = procTopologyCatchup_reset;
32
+ exports.procTopologyCatchup_roster = procTopologyCatchup_roster;
33
+ const cumin_1 = require("@fnndsc/cumin");
34
+ const book_js_1 = require("./book.js");
35
+ const feedTopology_js_1 = require("./feedTopology.js");
36
+ /**
37
+ * Queues roster feeds whose topology the cache lacks, and starts the walk
38
+ * when none is running. Nothing is queued while the global sweep is the
39
+ * one bringing topology in (it covers every feed), nor for a feed already
40
+ * loaded, loading or queued.
41
+ *
42
+ * @param feedIDs - Candidate feed IDs (a sync's arrivals, or the roster).
43
+ * @returns How many feeds this call queued.
44
+ */
45
+ function procTopologyCatchup_enqueue(feedIDs) {
46
+ const cache = (0, cumin_1.procCache_get)();
47
+ if (!cache.warmupComplete || (0, book_js_1.book_get)().procTopologyPromise !== null)
48
+ return 0;
49
+ let queued = 0;
50
+ for (const feedID of feedIDs) {
51
+ if (!cache.feed_get(feedID) || cache.topologyLoaded_has(feedID))
52
+ continue;
53
+ if (cache.loading_get(feedID) !== undefined || (0, book_js_1.book_get)().topologyCatchupQueued.has(feedID))
54
+ continue;
55
+ (0, book_js_1.book_get)().topologyCatchupQueue.push(feedID);
56
+ (0, book_js_1.book_get)().topologyCatchupQueued.add(feedID);
57
+ queued++;
58
+ }
59
+ if (queued > 0 && (0, book_js_1.book_get)().topologyCatchupRun === null) {
60
+ (0, book_js_1.book_get)().topologyCatchupRun = procTopologyCatchup_run().finally(() => { (0, book_js_1.book_get)().topologyCatchupRun = null; });
61
+ }
62
+ return queued;
63
+ }
64
+ /** Walks the queued feeds one at a time until the queue is empty. */
65
+ async function procTopologyCatchup_run() {
66
+ const cache = (0, cumin_1.procCache_get)();
67
+ for (;;) {
68
+ const feedID = (0, book_js_1.book_get)().topologyCatchupQueue.shift();
69
+ if (feedID === undefined)
70
+ return;
71
+ (0, book_js_1.book_get)().topologyCatchupQueued.delete(feedID);
72
+ if (!cache.feed_get(feedID) || cache.topologyLoaded_has(feedID))
73
+ continue;
74
+ // A sweep that started meanwhile covers the rest.
75
+ if ((0, book_js_1.book_get)().procTopologyPromise !== null) {
76
+ procTopologyCatchup_reset();
77
+ return;
78
+ }
79
+ (0, feedTopology_js_1.feedInstances_ensureStarted)(feedID);
80
+ const walk = cache.loading_get(feedID);
81
+ if (walk)
82
+ await walk.catch(() => { });
83
+ }
84
+ }
85
+ /**
86
+ * How many feeds still wait for their topology, and whether a walk runs.
87
+ *
88
+ * @returns The catch-up's state.
89
+ */
90
+ function procTopologyCatchup_status() {
91
+ return { queued: (0, book_js_1.book_get)().topologyCatchupQueue.length, running: (0, book_js_1.book_get)().topologyCatchupRun !== null };
92
+ }
93
+ /**
94
+ * Waits for the catch-up to drain (tests, and a readout that wants whole numbers).
95
+ *
96
+ * @returns Resolves when no walk is queued or running.
97
+ */
98
+ async function procTopologyCatchup_await() {
99
+ while ((0, book_js_1.book_get)().topologyCatchupRun !== null)
100
+ await (0, book_js_1.book_get)().topologyCatchupRun;
101
+ }
102
+ /**
103
+ * Forgets the queue (a sweep took over, or a cache cleared underneath us).
104
+ *
105
+ * @example
106
+ * procTopologyCatchup_reset();
107
+ */
108
+ function procTopologyCatchup_reset() {
109
+ (0, book_js_1.book_get)().topologyCatchupQueue.length = 0;
110
+ (0, book_js_1.book_get)().topologyCatchupQueued.clear();
111
+ }
112
+ /**
113
+ * Queues every roster feed without topology — what a roster sync leaves
114
+ * behind when the sweep is already over.
115
+ *
116
+ * @param cache - The process cache.
117
+ * @returns How many feeds were queued.
118
+ *
119
+ * @example
120
+ * procTopologyCatchup_roster(procCache_get());
121
+ */
122
+ function procTopologyCatchup_roster(cache) {
123
+ return procTopologyCatchup_enqueue(cache.feedIDs_get());
124
+ }
125
+ //# sourceMappingURL=catchup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catchup.js","sourceRoot":"","sources":["../../../../src/vfs/providers/proc/catchup.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AAgBH,kEAeC;AAuBD,gEAEC;AAOD,8DAEC;AAQD,8DAGC;AAYD,gEAEC;AAxFD,yCAA8D;AAE9D,uCAAqC;AACrC,uDAAgE;AAEhE;;;;;;;;GAQG;AACH,SAAgB,2BAA2B,CAAC,OAAiB;IAC3D,MAAM,KAAK,GAAc,IA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,0 +1,146 @@
1
+ /**
2
+ * @file The /proc feed index: the roster's full walk and single-feed reads.
3
+ *
4
+ * Walks the owned-and-shared and the public feed collections into the
5
+ * roster, joining a walk already in flight; ensures what one path needs
6
+ * before the provider answers it; and reads, adopts and judges one feed:
7
+ * its row asked of CUBE live, its jobs' status, whether it has settled and
8
+ * where its delta cursor stands.
9
+ *
10
+ * Key components:
11
+ * - procFeeds_index, procCache_build: the full walk of the feed index.
12
+ * - cache_ensure, cacheFor_ensure: what a whole-tree read, or one path, needs.
13
+ * - procFeed_probe, procFeedAbsent_probe, feedMeta_ensure, procFeed_ensureLoaded: one feed, read and adopted.
14
+ * - arrivalsUnseen_mark, rosterTotal_bump: what an arrival changes.
15
+ * - feedCached_isSettled, feedCursor_derive: one feed's jobs, judged.
16
+ *
17
+ * Typical usage:
18
+ * ```typescript
19
+ * await cacheFor_ensure('/proc/jobs/feed_7');
20
+ * ```
21
+ *
22
+ * Dependencies: `@fnndsc/cumin` (cache, feed and instance list contracts), `./book`, `./rows`,
23
+ * `./feedTopology`, `./catchup`, `./path`.
24
+ *
25
+ * @module
26
+ */
27
+ import { type ProcCache, type ProcFeed } from '@fnndsc/cumin';
28
+ import { type FeedPageFetch } from './book.js';
29
+ /**
30
+ * Indexes one complete paginated CUBE feed collection into the shared cache.
31
+ *
32
+ * @param page_fetch - Fetches one page of the collection.
33
+ * @param indexed - The feeds indexed so far, keyed by id; this walk adds to it.
34
+ * @returns The collection's total as the walk latched it, or null when no page carried one.
35
+ *
36
+ * @example
37
+ * const total: number | null = await procFeeds_index((params) => feedsPage_get(client, params), indexed);
38
+ */
39
+ export declare function procFeeds_index(page_fetch: FeedPageFetch, indexed: Map<number, ProcFeed>): Promise<number | null>;
40
+ /**
41
+ * Builds the feed index, joining a walk already in flight. A cold boot
42
+ * walks it behind the listening daemon (#1280), so a `/proc` read can
43
+ * arrive before it lands: the read waits on that walk instead of starting
44
+ * a second one.
45
+ *
46
+ * @returns IDs whose topology is new, changed, or currently active.
47
+ *
48
+ * @example
49
+ * const targets: number[] = await procCache_build();
50
+ */
51
+ export declare function procCache_build(): Promise<number[]>;
52
+ /**
53
+ * Ensures the feed index is built, building it on first access.
54
+ *
55
+ * @example
56
+ * await cache_ensure();
57
+ */
58
+ export declare function cache_ensure(): Promise<void>;
59
+ /**
60
+ * Ensures what one path needs. `/proc/jobs` itself needs the whole index. A
61
+ * path naming one feed needs that feed alone: its row is read and kept while
62
+ * the index builds on behind, so a fresh session's `ls /proc/jobs/feed_N` (or
63
+ * a `cd` into its `data`) answers in that feed's time, not every feed's
64
+ * (#1364: minutes before the first line, with the index warming).
65
+ *
66
+ * @param pathStr - The path asked for.
67
+ *
68
+ * @example
69
+ * await cacheFor_ensure('/proc/jobs/feed_7');
70
+ */
71
+ export declare function cacheFor_ensure(pathStr: string): Promise<void>;
72
+ /**
73
+ * Ensures instance topology is loaded for a feed without clearing existing data.
74
+ * Use this from proc find — it respects already-loaded feeds and the in-flight map.
75
+ * Use procCache_refresh(feedID) only when a forced reload is desired.
76
+ */
77
+ export declare function procFeed_ensureLoaded(feedID: number): Promise<void>;
78
+ /**
79
+ * Ensures a feed's metadata (title + job counters, needed for aggregate status) is cached
80
+ * with real values. No-op when the feed is already present with real metadata; fetches one
81
+ * `getFeeds({id})` only when the feed is missing or a zero-counter placeholder. Does NOT
82
+ * touch instance topology — reuse of the warm cache is the whole point.
83
+ *
84
+ * @param feedID - Feed whose metadata to ensure.
85
+ */
86
+ export declare function feedMeta_ensure(feedID: number): Promise<void>;
87
+ /**
88
+ * Asks CUBE for one feed, live, and adopts it into the roster: the way a
89
+ * feed shared to this identity, or made public, since the roster was
90
+ * walked is seen when it is asked for by name or id. A feed the roster
91
+ * already holds has its row refreshed. The yardsticks move with an
92
+ * adoption, so the next delta does not walk again for what this ask found.
93
+ *
94
+ * @param feedID - The feed to ask for.
95
+ * @returns The feed as the roster now holds it, or null when CUBE lists it
96
+ * in neither collection for this identity — not shared, or shared to a
97
+ * group the identity is not in.
98
+ * @throws {Error} When not connected.
99
+ */
100
+ export declare function procFeed_probe(feedID: number): Promise<ProcFeed | null>;
101
+ /**
102
+ * Marks arrivals shared with this identity as NEW since the last visit: a
103
+ * feed another identity owns and has not made public. A feed this
104
+ * identity made is not news to it, and a public feed anyone on CUBE made
105
+ * is not addressed to it; neither is marked.
106
+ *
107
+ * @param cache - The process cache.
108
+ * @param feedIDs - The feeds that just arrived.
109
+ *
110
+ * @example
111
+ * await arrivalsUnseen_mark(cache, [7]);
112
+ */
113
+ export declare function arrivalsUnseen_mark(cache: ProcCache, feedIDs: number[]): Promise<void>;
114
+ /**
115
+ * Asks CUBE for a feed the roster lacks, on a visit to its path, and says
116
+ * on the error stack when the ask itself failed; an absent feed is a null.
117
+ *
118
+ * @param feedID - The feed to ask for.
119
+ * @returns The adopted feed, or null.
120
+ *
121
+ * @example
122
+ * const feed: ProcFeed | null = await procFeedAbsent_probe(7);
123
+ */
124
+ export declare function procFeedAbsent_probe(feedID: number): Promise<ProcFeed | null>;
125
+ /**
126
+ * Whether every cached instance of a feed carries a terminal status. A fully
127
+ * settled feed can only change by having work appended to it, which the
128
+ * feed-row counters reveal.
129
+ *
130
+ * @param cache - The process cache.
131
+ * @param feedID - The feed to inspect.
132
+ * @returns True when no cached instance could still change status.
133
+ */
134
+ export declare function feedCached_isSettled(cache: ProcCache, feedID: number): boolean;
135
+ /**
136
+ * Derives a feed's delta cursor from what the cache already holds: the newest
137
+ * start or end timestamp across its instances.
138
+ *
139
+ * @param cache - The process cache.
140
+ * @param feedID - The feed whose rows to scan.
141
+ * @returns The newest timestamp, or null when no row carried one.
142
+ *
143
+ * @example
144
+ * const cursor: string | null = feedCursor_derive(cache, 7);
145
+ */
146
+ export declare function feedCursor_derive(cache: ProcCache, feedID: number): string | null;