@fnndsc/salsa 3.5.1 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/connect/index.d.ts +11 -0
- package/dist/connect/index.js +11 -0
- package/dist/connect/index.js.map +1 -1
- package/dist/dag/feedJoins.js +8 -7
- package/dist/dag/feedJoins.js.map +1 -1
- package/dist/feeds/index.d.ts +15 -2
- package/dist/feeds/index.js.map +1 -1
- package/dist/files/index.d.ts +7 -0
- package/dist/files/index.js +12 -11
- package/dist/files/index.js.map +1 -1
- package/dist/files/regular_content.js +11 -3
- package/dist/files/regular_content.js.map +1 -1
- package/dist/groups/index.d.ts +59 -0
- package/dist/groups/index.js +89 -0
- package/dist/groups/index.js.map +1 -1
- package/dist/groups/membershipRevision.d.ts +19 -0
- package/dist/groups/membershipRevision.js +29 -0
- package/dist/groups/membershipRevision.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs/jobOps.d.ts +4 -9
- package/dist/jobs/jobOps.js +77 -39
- package/dist/jobs/jobOps.js.map +1 -1
- package/dist/pipelines/diagram.js +19 -9
- package/dist/pipelines/diagram.js.map +1 -1
- package/dist/pipelines/index.d.ts +28 -5
- package/dist/pipelines/index.js +118 -57
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/invocation.d.ts +80 -0
- package/dist/pipelines/invocation.js +290 -0
- package/dist/pipelines/invocation.js.map +1 -0
- package/dist/pipelines/manifest.d.ts +88 -0
- package/dist/pipelines/manifest.js +216 -0
- package/dist/pipelines/manifest.js.map +1 -0
- package/dist/plugins/index.d.ts +29 -0
- package/dist/plugins/index.js +51 -10
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/internal/plugin_executeNewFeed.d.ts +0 -14
- package/dist/plugins/internal/plugin_executeNewFeed.js +3 -3
- package/dist/plugins/internal/plugin_executeNewFeed.js.map +1 -1
- package/dist/plugins/plugin_register.js +5 -5
- package/dist/plugins/plugin_register.js.map +1 -1
- package/dist/plugins/store_import.js +1 -1
- package/dist/plugins/store_import.js.map +1 -1
- package/dist/retrieve/watch.d.ts +114 -0
- package/dist/retrieve/watch.js +358 -0
- package/dist/retrieve/watch.js.map +1 -0
- package/dist/store/index.d.ts +17 -4
- package/dist/store/index.js +9 -4
- package/dist/store/index.js.map +1 -1
- package/dist/users/index.d.ts +36 -0
- package/dist/users/index.js +50 -0
- package/dist/users/index.js.map +1 -0
- package/dist/vfs/dispatcher.d.ts +11 -0
- package/dist/vfs/dispatcher.js +37 -6
- package/dist/vfs/dispatcher.js.map +1 -1
- package/dist/vfs/index.d.ts +1 -0
- package/dist/vfs/index.js +3 -0
- package/dist/vfs/index.js.map +1 -1
- package/dist/vfs/provider.d.ts +13 -0
- package/dist/vfs/providers/etc.d.ts +2 -0
- package/dist/vfs/providers/etc.js +41 -2
- package/dist/vfs/providers/etc.js.map +1 -1
- package/dist/vfs/providers/native.js +41 -7
- package/dist/vfs/providers/native.js.map +1 -1
- package/dist/vfs/providers/pacs.d.ts +13 -1
- package/dist/vfs/providers/pacs.js +86 -107
- package/dist/vfs/providers/pacs.js.map +1 -1
- package/dist/vfs/providers/pacsHelpers.js +9 -5
- package/dist/vfs/providers/pacsHelpers.js.map +1 -1
- package/dist/vfs/providers/proc.d.ts +34 -1
- package/dist/vfs/providers/proc.js +314 -84
- package/dist/vfs/providers/proc.js.map +1 -1
- package/package.json +11 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store_import.js","sourceRoot":"","sources":["../../src/plugins/store_import.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAwEH,wDAwFC;AA8GD,0DAEC;AA9QD,
|
|
1
|
+
{"version":3,"file":"store_import.js","sourceRoot":"","sources":["../../src/plugins/store_import.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAwEH,wDAwFC;AA8GD,0DAEC;AA9QD,yCAAoG;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AK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,YAAY,IAAI,IAAI;QACpB,OAAQ,IAAuB,CAAC,UAAU,KAAK,QAAQ,CACxD,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,uBAAuB;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type Client } from '@fnndsc/cumin';
|
|
2
|
+
/** Lifecycle states of one series retrieve. */
|
|
3
|
+
export type RetrieveStatus = 'pending' | 'pulling' | 'pulled' | 'stalled' | 'timeout' | 'error' | 'unfired';
|
|
4
|
+
/** Progress classification reported to event consumers. */
|
|
5
|
+
export type RetrieveProgressStatus = 'running' | 'done' | 'unconfirmed' | 'error' | 'stalled' | 'timeout';
|
|
6
|
+
/**
|
|
7
|
+
* Runtime state for a single series being retrieved.
|
|
8
|
+
*
|
|
9
|
+
* @property label - Display label for progress and summaries.
|
|
10
|
+
* @property seriesUID - DICOM SeriesInstanceUID.
|
|
11
|
+
* @property studyUID - DICOM StudyInstanceUID.
|
|
12
|
+
* @property pacsName - PACS identifier (`pacs_name` for LONK subscriptions).
|
|
13
|
+
* @property expectedFiles - File count from the originating query decode.
|
|
14
|
+
* @property syntheticQueryId - ID of the per-series synthetic PACSQuery.
|
|
15
|
+
* @property retrieveId - ID of the PACSRetrieve created for it.
|
|
16
|
+
* @property status - Current lifecycle status.
|
|
17
|
+
* @property actualFiles - Most recent file count from LONK progress updates.
|
|
18
|
+
* @property lastProgressFiles - `actualFiles` at the last progress tick (stall detection).
|
|
19
|
+
* @property lastProgressTime - Timestamp of the last progress tick.
|
|
20
|
+
* @property startTime - Timestamp when the retrieve was fired.
|
|
21
|
+
* @property lonkConfirmed - True only after an explicit LONK `done` or a storage confirmation.
|
|
22
|
+
* @property cubePathDir - CUBE folder the series landed in (resolved post-pull).
|
|
23
|
+
*/
|
|
24
|
+
export interface RetrieveTask {
|
|
25
|
+
label: string;
|
|
26
|
+
seriesUID: string;
|
|
27
|
+
studyUID: string;
|
|
28
|
+
pacsName: string;
|
|
29
|
+
expectedFiles: number;
|
|
30
|
+
syntheticQueryId: number | null;
|
|
31
|
+
retrieveId: number | null;
|
|
32
|
+
status: RetrieveStatus;
|
|
33
|
+
actualFiles: number;
|
|
34
|
+
lastProgressFiles: number;
|
|
35
|
+
lastProgressTime: number;
|
|
36
|
+
startTime: number;
|
|
37
|
+
lonkConfirmed: boolean;
|
|
38
|
+
cubePathDir: string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Consumer callbacks for engine progress.
|
|
42
|
+
*
|
|
43
|
+
* @property task - One series changed state or progressed.
|
|
44
|
+
* @property retryRound - A refire round for unconfirmed series is starting.
|
|
45
|
+
*/
|
|
46
|
+
export interface RetrieveWatchEvents {
|
|
47
|
+
task?: (task: RetrieveTask, status: RetrieveProgressStatus, phase: 'watching' | 'retrying') => void;
|
|
48
|
+
retryRound?: (attempt: number, retryMax: number, count: number) => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Builds a fresh retrieve task from series identity facts.
|
|
52
|
+
*
|
|
53
|
+
* @param info - Label, UIDs, PACS name, and expected file count.
|
|
54
|
+
* @returns A pending task ready for {@link retrieve_fireAndWatch}.
|
|
55
|
+
*/
|
|
56
|
+
export declare function retrieveTask_make(info: {
|
|
57
|
+
label: string;
|
|
58
|
+
seriesUID: string;
|
|
59
|
+
studyUID: string;
|
|
60
|
+
pacsName: string;
|
|
61
|
+
expectedFiles: number;
|
|
62
|
+
}): RetrieveTask;
|
|
63
|
+
/**
|
|
64
|
+
* Classifies a task's state for progress reporting.
|
|
65
|
+
*
|
|
66
|
+
* @param task - The task to classify.
|
|
67
|
+
* @returns The progress status consumers render.
|
|
68
|
+
*/
|
|
69
|
+
export declare function retrieveProgress_classify(task: RetrieveTask): RetrieveProgressStatus;
|
|
70
|
+
/**
|
|
71
|
+
* Marks tasks whose series are already fully registered in CUBE as pulled,
|
|
72
|
+
* so firing skips them. This is what makes a retrieve idempotent: re-running
|
|
73
|
+
* the same request after a partial failure fetches only the missing series.
|
|
74
|
+
*
|
|
75
|
+
* @param tasks - All tasks; complete ones are mutated to pulled.
|
|
76
|
+
* @returns How many tasks were marked complete and skipped.
|
|
77
|
+
*/
|
|
78
|
+
export declare function retrieveTasks_skipComplete(tasks: RetrieveTask[]): Promise<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Fires retrieves for tasks (bounded, retried) without watching: the
|
|
81
|
+
* fire-and-exit path (`pull --nowait`). Tasks that could not fire are left
|
|
82
|
+
* in the `unfired` state.
|
|
83
|
+
*
|
|
84
|
+
* @param tasks - Tasks to fire.
|
|
85
|
+
* @param pacsserver - Resolved PACS server identifier.
|
|
86
|
+
*/
|
|
87
|
+
export declare function retrieveTasks_fire(tasks: RetrieveTask[], pacsserver: string): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Opens a LONK WebSocket, fires retrieves for the tasks, and blocks until
|
|
90
|
+
* every task reaches a terminal state. Mutates each task's status,
|
|
91
|
+
* actualFiles, and lonkConfirmed; reports progress through the events.
|
|
92
|
+
*
|
|
93
|
+
* @param tasks - Tasks to subscribe, fire, and watch.
|
|
94
|
+
* @param pacsserver - Resolved PACS server identifier.
|
|
95
|
+
* @param client - Authenticated ChRIS API client (for the LONK token).
|
|
96
|
+
* @param events - Progress callbacks.
|
|
97
|
+
* @param phase - Phase tag passed through to task events.
|
|
98
|
+
* @returns Number of tasks whose retrieve could not be fired.
|
|
99
|
+
*/
|
|
100
|
+
export declare function retrieve_fireAndWatch(tasks: RetrieveTask[], pacsserver: string, client: Client, events?: RetrieveWatchEvents, phase?: 'watching' | 'retrying'): Promise<number>;
|
|
101
|
+
/**
|
|
102
|
+
* Confirms unconfirmed series against CUBE storage and refires the rest, up
|
|
103
|
+
* to `retryMax` rounds; series still unconfirmed afterwards are marked
|
|
104
|
+
* errored. This closes the gap between a lost LONK confirmation (cosmetic)
|
|
105
|
+
* and a retrieve that genuinely never delivered (real loss).
|
|
106
|
+
*
|
|
107
|
+
* @param allTasks - All tasks from the initial watch.
|
|
108
|
+
* @param retryMax - Maximum refire rounds.
|
|
109
|
+
* @param pacsserver - The PACS server identifier.
|
|
110
|
+
* @param client - The connected ChRIS client.
|
|
111
|
+
* @param events - Progress callbacks.
|
|
112
|
+
* @returns The number of additional firing errors incurred.
|
|
113
|
+
*/
|
|
114
|
+
export declare function retrieve_confirmLoop(allTasks: RetrieveTask[], retryMax: number, pacsserver: string, client: Client, events?: RetrieveWatchEvents): Promise<number>;
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.retrieveTask_make = retrieveTask_make;
|
|
7
|
+
exports.retrieveProgress_classify = retrieveProgress_classify;
|
|
8
|
+
exports.retrieveTasks_skipComplete = retrieveTasks_skipComplete;
|
|
9
|
+
exports.retrieveTasks_fire = retrieveTasks_fire;
|
|
10
|
+
exports.retrieve_fireAndWatch = retrieve_fireAndWatch;
|
|
11
|
+
exports.retrieve_confirmLoop = retrieve_confirmLoop;
|
|
12
|
+
/**
|
|
13
|
+
* @file PACS retrieve engine: fire, watch, confirm.
|
|
14
|
+
*
|
|
15
|
+
* The single implementation of "make DICOM series land in CUBE and know when
|
|
16
|
+
* they have": synthetic query+retrieve firing with bounded concurrency and
|
|
17
|
+
* per-step retry, a LONK WebSocket watch with stall/timeout/no-activity
|
|
18
|
+
* detection, storage-side confirmation across registration lag, and an
|
|
19
|
+
* optional refire loop for unconfirmed series. Both consumers (the `pull`
|
|
20
|
+
* builtin in brasa and the PACS VFS provider's `cp`) previously solved this
|
|
21
|
+
* independently — LONK push versus 5-second polling — with different
|
|
22
|
+
* semantics; this module is the convergence (docs/code-audit-2026-08.adoc,
|
|
23
|
+
* decisions section).
|
|
24
|
+
*
|
|
25
|
+
* The engine is presentation-free: progress is reported through the
|
|
26
|
+
* {@link RetrieveWatchEvents} callbacks and consumers render it however their
|
|
27
|
+
* surface renders (structured sink progress, plain console lines).
|
|
28
|
+
*
|
|
29
|
+
* @module
|
|
30
|
+
*/
|
|
31
|
+
const ws_1 = __importDefault(require("ws"));
|
|
32
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
33
|
+
/** Concurrent retrieve creations; more overloads CUBE and loses retrieves. */
|
|
34
|
+
const FIRE_CONCURRENCY = 4;
|
|
35
|
+
/** Retry attempts for one retrieve creation, with backoff between them. */
|
|
36
|
+
const FIRE_ATTEMPTS = 3;
|
|
37
|
+
const FIRE_BACKOFF_MS = [250, 500];
|
|
38
|
+
const STALL_TIMEOUT_MS = 30_000;
|
|
39
|
+
const NO_ACTIVITY_TIMEOUT_MS = 15_000;
|
|
40
|
+
const SERIES_TIMEOUT_MS = 5 * 60 * 1_000;
|
|
41
|
+
const CHECKER_INTERVAL_MS = 2_000;
|
|
42
|
+
/**
|
|
43
|
+
* Builds a fresh retrieve task from series identity facts.
|
|
44
|
+
*
|
|
45
|
+
* @param info - Label, UIDs, PACS name, and expected file count.
|
|
46
|
+
* @returns A pending task ready for {@link retrieve_fireAndWatch}.
|
|
47
|
+
*/
|
|
48
|
+
function retrieveTask_make(info) {
|
|
49
|
+
return {
|
|
50
|
+
...info,
|
|
51
|
+
syntheticQueryId: null,
|
|
52
|
+
retrieveId: null,
|
|
53
|
+
status: 'pending',
|
|
54
|
+
actualFiles: 0,
|
|
55
|
+
lastProgressFiles: 0,
|
|
56
|
+
lastProgressTime: Date.now(),
|
|
57
|
+
startTime: 0,
|
|
58
|
+
lonkConfirmed: false,
|
|
59
|
+
cubePathDir: null,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Classifies a task's state for progress reporting.
|
|
64
|
+
*
|
|
65
|
+
* @param task - The task to classify.
|
|
66
|
+
* @returns The progress status consumers render.
|
|
67
|
+
*/
|
|
68
|
+
function retrieveProgress_classify(task) {
|
|
69
|
+
if (task.status === 'pulled')
|
|
70
|
+
return task.lonkConfirmed ? 'done' : 'unconfirmed';
|
|
71
|
+
if (task.status === 'pending' || task.status === 'pulling')
|
|
72
|
+
return 'running';
|
|
73
|
+
if (task.status === 'unfired')
|
|
74
|
+
return 'error';
|
|
75
|
+
return task.status;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Marks tasks whose series are already fully registered in CUBE as pulled,
|
|
79
|
+
* so firing skips them. This is what makes a retrieve idempotent: re-running
|
|
80
|
+
* the same request after a partial failure fetches only the missing series.
|
|
81
|
+
*
|
|
82
|
+
* @param tasks - All tasks; complete ones are mutated to pulled.
|
|
83
|
+
* @returns How many tasks were marked complete and skipped.
|
|
84
|
+
*/
|
|
85
|
+
async function retrieveTasks_skipComplete(tasks) {
|
|
86
|
+
let skipped = 0;
|
|
87
|
+
await Promise.all(tasks.map(async (task) => {
|
|
88
|
+
const stateResult = await (0, cumin_1.seriesStorage_resolve)(task.seriesUID);
|
|
89
|
+
if (!stateResult.ok)
|
|
90
|
+
return;
|
|
91
|
+
const state = stateResult.value;
|
|
92
|
+
if (task.expectedFiles > 0 && state.fileCount >= task.expectedFiles && state.folderPath !== null) {
|
|
93
|
+
task.status = 'pulled';
|
|
94
|
+
task.lonkConfirmed = true;
|
|
95
|
+
task.actualFiles = state.fileCount;
|
|
96
|
+
task.cubePathDir = state.folderPath;
|
|
97
|
+
skipped++;
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
return skipped;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Creates a synthetic PACSQuery + PACSRetrieve for a single series, with
|
|
104
|
+
* bounded retry: creation failures during a server brown-out are permanent
|
|
105
|
+
* data loss for the run (nothing ever retrieves), so each series gets a few
|
|
106
|
+
* attempts before it is declared unfired.
|
|
107
|
+
*
|
|
108
|
+
* @param task - The task to fire (mutated: syntheticQueryId, retrieveId, startTime, status).
|
|
109
|
+
* @param pacsserver - Resolved PACS server ID string.
|
|
110
|
+
*/
|
|
111
|
+
async function task_fire(task, pacsserver) {
|
|
112
|
+
const fired = await (0, cumin_1.retry_untilValue)(FIRE_ATTEMPTS, FIRE_BACKOFF_MS, async () => {
|
|
113
|
+
const queryData = {
|
|
114
|
+
// CUBE rejects duplicate query titles per user; a timestamp keeps
|
|
115
|
+
// re-pull titles unique.
|
|
116
|
+
title: `pull_${task.seriesUID}_${Date.now().toString(36)}`,
|
|
117
|
+
query: JSON.stringify({
|
|
118
|
+
SeriesInstanceUID: task.seriesUID,
|
|
119
|
+
StudyInstanceUID: task.studyUID,
|
|
120
|
+
}),
|
|
121
|
+
execute: false,
|
|
122
|
+
};
|
|
123
|
+
const queryResult = await (0, cumin_1.pacsQueries_create)(pacsserver, queryData);
|
|
124
|
+
if (!queryResult.ok)
|
|
125
|
+
return null;
|
|
126
|
+
const retrieveResult = await (0, cumin_1.pacsRetrieve_create)(queryResult.value.id);
|
|
127
|
+
if (!retrieveResult.ok)
|
|
128
|
+
return null;
|
|
129
|
+
return { queryId: queryResult.value.id, retrieveId: retrieveResult.value.id };
|
|
130
|
+
});
|
|
131
|
+
if (fired === null) {
|
|
132
|
+
task.status = 'unfired';
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
task.syntheticQueryId = fired.queryId;
|
|
136
|
+
task.retrieveId = fired.retrieveId;
|
|
137
|
+
task.startTime = Date.now();
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Fires retrieves with bounded concurrency, so a large study does not
|
|
141
|
+
* stampede CUBE with parallel creations (the overload that loses retrieves
|
|
142
|
+
* in the first place).
|
|
143
|
+
*
|
|
144
|
+
* @param tasks - Tasks to fire.
|
|
145
|
+
* @param pacsserver - Resolved PACS server identifier.
|
|
146
|
+
*/
|
|
147
|
+
async function tasks_fireBounded(tasks, pacsserver) {
|
|
148
|
+
let next = 0;
|
|
149
|
+
const worker = async () => {
|
|
150
|
+
while (next < tasks.length) {
|
|
151
|
+
const task = tasks[next++];
|
|
152
|
+
await task_fire(task, pacsserver);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
await Promise.all(Array.from({ length: Math.min(FIRE_CONCURRENCY, tasks.length) }, () => worker()));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Fires retrieves for tasks (bounded, retried) without watching: the
|
|
159
|
+
* fire-and-exit path (`pull --nowait`). Tasks that could not fire are left
|
|
160
|
+
* in the `unfired` state.
|
|
161
|
+
*
|
|
162
|
+
* @param tasks - Tasks to fire.
|
|
163
|
+
* @param pacsserver - Resolved PACS server identifier.
|
|
164
|
+
*/
|
|
165
|
+
async function retrieveTasks_fire(tasks, pacsserver) {
|
|
166
|
+
await tasks_fireBounded(tasks, pacsserver);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Constructs a LONK WebSocket URL from a download token response.
|
|
170
|
+
*
|
|
171
|
+
* @param tokenUrl - The download token resource URL.
|
|
172
|
+
* @param token - The actual download token string.
|
|
173
|
+
* @returns WebSocket URL for the LONK endpoint.
|
|
174
|
+
*/
|
|
175
|
+
function lonkWsUrl_build(tokenUrl, token) {
|
|
176
|
+
return tokenUrl
|
|
177
|
+
.replace(/^http(s?):\/\//, (_m, s) => `ws${s}://`)
|
|
178
|
+
.replace(/v1\/downloadtokens\/\d+\//, `v1/pacs/ws/?token=${token}`);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Opens a LONK WebSocket, fires retrieves for the tasks, and blocks until
|
|
182
|
+
* every task reaches a terminal state. Mutates each task's status,
|
|
183
|
+
* actualFiles, and lonkConfirmed; reports progress through the events.
|
|
184
|
+
*
|
|
185
|
+
* @param tasks - Tasks to subscribe, fire, and watch.
|
|
186
|
+
* @param pacsserver - Resolved PACS server identifier.
|
|
187
|
+
* @param client - Authenticated ChRIS API client (for the LONK token).
|
|
188
|
+
* @param events - Progress callbacks.
|
|
189
|
+
* @param phase - Phase tag passed through to task events.
|
|
190
|
+
* @returns Number of tasks whose retrieve could not be fired.
|
|
191
|
+
*/
|
|
192
|
+
async function retrieve_fireAndWatch(tasks, pacsserver, client, events = {}, phase = 'watching') {
|
|
193
|
+
const emit = (task, status) => {
|
|
194
|
+
events.task?.(task, status ?? retrieveProgress_classify(task), phase);
|
|
195
|
+
};
|
|
196
|
+
const downloadToken = await (0, cumin_1.downloadToken_create)(client);
|
|
197
|
+
const ws = new ws_1.default(lonkWsUrl_build(downloadToken.url, downloadToken.token));
|
|
198
|
+
await new Promise((openResolve, openReject) => {
|
|
199
|
+
ws.once('open', openResolve);
|
|
200
|
+
ws.once('error', (err) => openReject(err));
|
|
201
|
+
});
|
|
202
|
+
for (const t of tasks) {
|
|
203
|
+
ws.send(JSON.stringify({ SeriesInstanceUID: t.seriesUID, pacs_name: t.pacsName, action: 'subscribe' }));
|
|
204
|
+
}
|
|
205
|
+
await tasks_fireBounded(tasks, pacsserver);
|
|
206
|
+
const fired = tasks.filter((t) => t.status !== 'unfired');
|
|
207
|
+
const firingErrors = tasks.length - fired.length;
|
|
208
|
+
if (fired.length === 0) {
|
|
209
|
+
for (const t of tasks) {
|
|
210
|
+
if (t.status === 'unfired')
|
|
211
|
+
emit(t, 'error');
|
|
212
|
+
}
|
|
213
|
+
ws.close();
|
|
214
|
+
return firingErrors;
|
|
215
|
+
}
|
|
216
|
+
for (const t of tasks) {
|
|
217
|
+
emit(t, t.status === 'unfired' ? 'error' : 'running');
|
|
218
|
+
}
|
|
219
|
+
const taskByUID = new Map(tasks.map((t) => [t.seriesUID, t]));
|
|
220
|
+
await new Promise((resolve) => {
|
|
221
|
+
let resolved = false;
|
|
222
|
+
const done = () => {
|
|
223
|
+
if (resolved)
|
|
224
|
+
return;
|
|
225
|
+
resolved = true;
|
|
226
|
+
clearInterval(checker);
|
|
227
|
+
try {
|
|
228
|
+
ws.close();
|
|
229
|
+
}
|
|
230
|
+
catch { /* best-effort socket cleanup */ }
|
|
231
|
+
resolve();
|
|
232
|
+
};
|
|
233
|
+
const checker = setInterval(() => {
|
|
234
|
+
const now = Date.now();
|
|
235
|
+
let allTerminal = true;
|
|
236
|
+
for (const t of fired) {
|
|
237
|
+
if (t.status === 'pulled' || t.status === 'error' || t.status === 'unfired' || t.status === 'stalled' || t.status === 'timeout') {
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
allTerminal = false;
|
|
241
|
+
if (t.startTime > 0 && now - t.startTime > SERIES_TIMEOUT_MS) {
|
|
242
|
+
t.status = 'timeout';
|
|
243
|
+
emit(t, 'timeout');
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (t.actualFiles > 0 && now - t.lastProgressTime > STALL_TIMEOUT_MS) {
|
|
247
|
+
t.status = 'stalled';
|
|
248
|
+
emit(t, 'stalled');
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
if (t.startTime > 0 && t.actualFiles === 0 && now - t.startTime > NO_ACTIVITY_TIMEOUT_MS) {
|
|
252
|
+
t.status = 'pulled';
|
|
253
|
+
t.lonkConfirmed = false;
|
|
254
|
+
emit(t, 'unconfirmed');
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (allTerminal)
|
|
259
|
+
done();
|
|
260
|
+
}, CHECKER_INTERVAL_MS);
|
|
261
|
+
ws.on('message', (data) => {
|
|
262
|
+
try {
|
|
263
|
+
const outer = JSON.parse(data.toString());
|
|
264
|
+
const seriesUID = outer.SeriesInstanceUID;
|
|
265
|
+
const message = outer.message;
|
|
266
|
+
if (!seriesUID || !message)
|
|
267
|
+
return;
|
|
268
|
+
const t = taskByUID.get(seriesUID);
|
|
269
|
+
if (!t)
|
|
270
|
+
return;
|
|
271
|
+
if ('ndicom' in message && typeof message.ndicom === 'number') {
|
|
272
|
+
const n = message.ndicom;
|
|
273
|
+
t.actualFiles = n;
|
|
274
|
+
t.lastProgressFiles = n;
|
|
275
|
+
t.lastProgressTime = Date.now();
|
|
276
|
+
if (t.status === 'pending')
|
|
277
|
+
t.status = 'pulling';
|
|
278
|
+
emit(t, 'running');
|
|
279
|
+
}
|
|
280
|
+
else if ('done' in message && message.done === true) {
|
|
281
|
+
t.status = 'pulled';
|
|
282
|
+
t.lonkConfirmed = true;
|
|
283
|
+
if (t.actualFiles < t.expectedFiles)
|
|
284
|
+
t.actualFiles = t.expectedFiles;
|
|
285
|
+
emit(t, 'done');
|
|
286
|
+
}
|
|
287
|
+
else if ('error' in message && typeof message.error === 'string') {
|
|
288
|
+
t.status = 'error';
|
|
289
|
+
emit(t, 'error');
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
// Deliberate absorption: a malformed LONK frame carries no correlation
|
|
294
|
+
// to fail; the checker's stall/timeout guards still bound the watch.
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
ws.on('error', () => {
|
|
298
|
+
for (const t of fired) {
|
|
299
|
+
if (t.status === 'pending' || t.status === 'pulling') {
|
|
300
|
+
t.status = 'error';
|
|
301
|
+
emit(t, 'error');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
done();
|
|
305
|
+
});
|
|
306
|
+
ws.on('close', () => { done(); });
|
|
307
|
+
});
|
|
308
|
+
return firingErrors;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Confirms unconfirmed series against CUBE storage and refires the rest, up
|
|
312
|
+
* to `retryMax` rounds; series still unconfirmed afterwards are marked
|
|
313
|
+
* errored. This closes the gap between a lost LONK confirmation (cosmetic)
|
|
314
|
+
* and a retrieve that genuinely never delivered (real loss).
|
|
315
|
+
*
|
|
316
|
+
* @param allTasks - All tasks from the initial watch.
|
|
317
|
+
* @param retryMax - Maximum refire rounds.
|
|
318
|
+
* @param pacsserver - The PACS server identifier.
|
|
319
|
+
* @param client - The connected ChRIS client.
|
|
320
|
+
* @param events - Progress callbacks.
|
|
321
|
+
* @returns The number of additional firing errors incurred.
|
|
322
|
+
*/
|
|
323
|
+
async function retrieve_confirmLoop(allTasks, retryMax, pacsserver, client, events = {}) {
|
|
324
|
+
let extraFiringErrors = 0;
|
|
325
|
+
let retryCandidates = allTasks.filter((t) => t.status === 'pulled' && !t.lonkConfirmed);
|
|
326
|
+
for (let attempt = 1; attempt <= retryMax && retryCandidates.length > 0; attempt++) {
|
|
327
|
+
await Promise.all(retryCandidates.map(async (t) => {
|
|
328
|
+
const stateResult = await (0, cumin_1.seriesStorage_resolve)(t.seriesUID);
|
|
329
|
+
if (stateResult.ok && stateResult.value.folderPath !== null) {
|
|
330
|
+
t.lonkConfirmed = true;
|
|
331
|
+
t.cubePathDir = stateResult.value.folderPath;
|
|
332
|
+
}
|
|
333
|
+
}));
|
|
334
|
+
retryCandidates = retryCandidates.filter((t) => !t.lonkConfirmed);
|
|
335
|
+
if (retryCandidates.length === 0)
|
|
336
|
+
break;
|
|
337
|
+
events.retryRound?.(attempt, retryMax, retryCandidates.length);
|
|
338
|
+
for (const t of retryCandidates) {
|
|
339
|
+
t.status = 'pending';
|
|
340
|
+
t.actualFiles = 0;
|
|
341
|
+
t.lastProgressFiles = 0;
|
|
342
|
+
t.lastProgressTime = Date.now();
|
|
343
|
+
t.startTime = 0;
|
|
344
|
+
t.lonkConfirmed = false;
|
|
345
|
+
t.syntheticQueryId = null;
|
|
346
|
+
t.retrieveId = null;
|
|
347
|
+
events.task?.(t, 'running', 'retrying');
|
|
348
|
+
}
|
|
349
|
+
extraFiringErrors += await retrieve_fireAndWatch(retryCandidates, pacsserver, client, events, 'retrying');
|
|
350
|
+
retryCandidates = retryCandidates.filter((t) => t.status === 'pulled' && !t.lonkConfirmed);
|
|
351
|
+
}
|
|
352
|
+
for (const t of retryCandidates) {
|
|
353
|
+
t.status = 'error';
|
|
354
|
+
events.task?.(t, 'error', 'retrying');
|
|
355
|
+
}
|
|
356
|
+
return extraFiringErrors;
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=watch.js.map
|
|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C,MAAM,GAAG,SAAS,CAAC;YACrB,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC;YAClB,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC;YACxB,CAAC,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAChC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;YAChB,CAAC,CAAC,aAAa,GAAG,KAAK,CAAC;YACxB,CAAC,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC1B,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC;YACpB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QAC1C,CAAC;QAED,iBAAiB,IAAI,MAAM,qBAAqB,CAAC,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAE1G,eAAe,GAAG,eAAe,CAAC,MAAM,CACtC,CAAC,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,aAAa,CAC/D,CAAC;IACJ,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC;QAChC,CAAC,CAAC,MAAM,GAAG,OAAO,CAAC;QACnB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Store operations.
|
|
3
|
+
*
|
|
4
|
+
* Logic for interacting with the peer ChRIS store (listing, searching).
|
|
5
|
+
* Failures propagate as Err rather than an empty array, so a store outage is
|
|
6
|
+
* distinguishable from a store with no plugins; the underlying fetch has
|
|
7
|
+
* already pushed its reason onto the error stack.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { Result } from '@fnndsc/cumin';
|
|
1
12
|
/**
|
|
2
13
|
* Lists plugins from the peer store.
|
|
3
14
|
*
|
|
4
15
|
* @param storeUrl - Optional URL of the peer store.
|
|
5
|
-
* @returns
|
|
16
|
+
* @returns Ok with raw plugin objects (possibly empty), or Err when the store
|
|
17
|
+
* fetch failed (reason already on the error stack).
|
|
6
18
|
*/
|
|
7
|
-
export declare function store_list(storeUrl?: string): Promise<Record<string, unknown>[]
|
|
19
|
+
export declare function store_list(storeUrl?: string): Promise<Result<Record<string, unknown>[]>>;
|
|
8
20
|
/**
|
|
9
21
|
* Searches plugins in the peer store.
|
|
10
22
|
*
|
|
11
23
|
* @param query - Search query (e.g. plugin name substring).
|
|
12
24
|
* @param storeUrl - Optional URL of the peer store.
|
|
13
|
-
* @returns
|
|
25
|
+
* @returns Ok with matching raw plugin objects (possibly empty), or Err when
|
|
26
|
+
* the store fetch failed (reason already on the error stack).
|
|
14
27
|
*/
|
|
15
|
-
export declare function store_search(query: string, storeUrl?: string): Promise<Record<string, unknown>[]
|
|
28
|
+
export declare function store_search(query: string, storeUrl?: string): Promise<Result<Record<string, unknown>[]>>;
|
package/dist/store/index.js
CHANGED
|
@@ -6,6 +6,9 @@ exports.store_search = store_search;
|
|
|
6
6
|
* @file Store operations.
|
|
7
7
|
*
|
|
8
8
|
* Logic for interacting with the peer ChRIS store (listing, searching).
|
|
9
|
+
* Failures propagate as Err rather than an empty array, so a store outage is
|
|
10
|
+
* distinguishable from a store with no plugins; the underlying fetch has
|
|
11
|
+
* already pushed its reason onto the error stack.
|
|
9
12
|
*
|
|
10
13
|
* @module
|
|
11
14
|
*/
|
|
@@ -14,24 +17,26 @@ const cumin_1 = require("@fnndsc/cumin");
|
|
|
14
17
|
* Lists plugins from the peer store.
|
|
15
18
|
*
|
|
16
19
|
* @param storeUrl - Optional URL of the peer store.
|
|
17
|
-
* @returns
|
|
20
|
+
* @returns Ok with raw plugin objects (possibly empty), or Err when the store
|
|
21
|
+
* fetch failed (reason already on the error stack).
|
|
18
22
|
*/
|
|
19
23
|
async function store_list(storeUrl) {
|
|
20
24
|
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
21
25
|
const plugins = await chrisPlugin.plugin_listPeerStore(storeUrl);
|
|
22
|
-
return plugins
|
|
26
|
+
return plugins === null ? (0, cumin_1.Err)() : (0, cumin_1.Ok)(plugins);
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
29
|
* Searches plugins in the peer store.
|
|
26
30
|
*
|
|
27
31
|
* @param query - Search query (e.g. plugin name substring).
|
|
28
32
|
* @param storeUrl - Optional URL of the peer store.
|
|
29
|
-
* @returns
|
|
33
|
+
* @returns Ok with matching raw plugin objects (possibly empty), or Err when
|
|
34
|
+
* the store fetch failed (reason already on the error stack).
|
|
30
35
|
*/
|
|
31
36
|
async function store_search(query, storeUrl) {
|
|
32
37
|
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
33
38
|
// Search by name
|
|
34
39
|
const plugins = await chrisPlugin.plugin_listPeerStore(storeUrl, { name: query });
|
|
35
|
-
return plugins
|
|
40
|
+
return plugins === null ? (0, cumin_1.Err)() : (0, cumin_1.Ok)(plugins);
|
|
36
41
|
}
|
|
37
42
|
//# sourceMappingURL=index.js.map
|
package/dist/store/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":";;AAmBA,gCAIC;AAUD,oCAKC;AAtCD;;;;;;;;;GASG;AACH,yCAA6D;AAE7D;;;;;;GAMG;AACI,KAAK,UAAU,UAAU,CAAC,QAAiB;IAChD,MAAM,WAAW,GAAgB,IAAI,mBAAW,EAAE,CAAC;IACnD,MAAM,OAAO,GAAqC,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACnG,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAA,WAAG,GAAE,CAAC,CAAC,CAAC,IAAA,UAAE,EAAC,OAAO,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,QAAiB;IACjE,MAAM,WAAW,GAAgB,IAAI,mBAAW,EAAE,CAAC;IACnD,iBAAiB;IACjB,MAAM,OAAO,GAAqC,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACpH,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAA,WAAG,GAAE,CAAC,CAAC,CAAC,IAAA,UAAE,EAAC,OAAO,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file CUBE-local account operation facade.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { type LocalAccount, type LocalAccountAction, type Result } from '@fnndsc/cumin';
|
|
6
|
+
export type { LocalAccount, LocalAccountAction, Result };
|
|
7
|
+
/**
|
|
8
|
+
* Verifies that the current identity may use local-account administration.
|
|
9
|
+
*
|
|
10
|
+
* @returns Success when the active CUBE identity has account-admin access.
|
|
11
|
+
*/
|
|
12
|
+
export declare function localAccount_adminAccessEnsure(): Promise<Result<void>>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates one CUBE-local account.
|
|
15
|
+
*
|
|
16
|
+
* @param username - New local username.
|
|
17
|
+
* @param email - Account email address.
|
|
18
|
+
* @param password - Initial local-login password.
|
|
19
|
+
* @returns The created account or an operation error.
|
|
20
|
+
*/
|
|
21
|
+
export declare function localAccount_create(username: string, email: string, password: string): Promise<Result<LocalAccount>>;
|
|
22
|
+
/**
|
|
23
|
+
* Finds one CUBE-local account by exact username.
|
|
24
|
+
*
|
|
25
|
+
* @param username - Exact local username.
|
|
26
|
+
* @returns The matching account or an operation error.
|
|
27
|
+
*/
|
|
28
|
+
export declare function localAccount_find(username: string): Promise<Result<LocalAccount>>;
|
|
29
|
+
/**
|
|
30
|
+
* Changes the lifecycle state of one CUBE-local account.
|
|
31
|
+
*
|
|
32
|
+
* @param accountID - Stable local-account record identifier.
|
|
33
|
+
* @param action - Lifecycle transition to apply.
|
|
34
|
+
* @returns The updated account or an operation error.
|
|
35
|
+
*/
|
|
36
|
+
export declare function localAccount_action(accountID: number, action: LocalAccountAction): Promise<Result<LocalAccount>>;
|