@fnndsc/salsa 3.2.4
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/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/compute/index.d.ts +17 -0
- package/dist/compute/index.js +33 -0
- package/dist/compute/index.js.map +1 -0
- package/dist/connect/index.d.ts +25 -0
- package/dist/connect/index.js +27 -0
- package/dist/connect/index.js.map +1 -0
- package/dist/context/index.d.ts +38 -0
- package/dist/context/index.js +58 -0
- package/dist/context/index.js.map +1 -0
- package/dist/feeds/index.d.ts +60 -0
- package/dist/feeds/index.js +101 -0
- package/dist/feeds/index.js.map +1 -0
- package/dist/files/index.d.ts +179 -0
- package/dist/files/index.js +562 -0
- package/dist/files/index.js.map +1 -0
- package/dist/files/pacs_content.d.ts +29 -0
- package/dist/files/pacs_content.js +121 -0
- package/dist/files/pacs_content.js.map +1 -0
- package/dist/files/pipeline_content.d.ts +22 -0
- package/dist/files/pipeline_content.js +31 -0
- package/dist/files/pipeline_content.js.map +1 -0
- package/dist/files/regular_content.d.ts +33 -0
- package/dist/files/regular_content.js +177 -0
- package/dist/files/regular_content.js.map +1 -0
- package/dist/groups/index.d.ts +21 -0
- package/dist/groups/index.js +37 -0
- package/dist/groups/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/index.d.ts +6 -0
- package/dist/jobs/index.js +17 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobOps.d.ts +108 -0
- package/dist/jobs/jobOps.js +307 -0
- package/dist/jobs/jobOps.js.map +1 -0
- package/dist/pacs/index.d.ts +64 -0
- package/dist/pacs/index.js +91 -0
- package/dist/pacs/index.js.map +1 -0
- package/dist/pacs/resultDecode.d.ts +13 -0
- package/dist/pacs/resultDecode.js +19 -0
- package/dist/pacs/resultDecode.js.map +1 -0
- package/dist/pipelines/index.d.ts +58 -0
- package/dist/pipelines/index.js +194 -0
- package/dist/pipelines/index.js.map +1 -0
- package/dist/plugininstances/index.d.ts +15 -0
- package/dist/plugininstances/index.js +27 -0
- package/dist/plugininstances/index.js.map +1 -0
- package/dist/pluginmetas/index.d.ts +21 -0
- package/dist/pluginmetas/index.js +37 -0
- package/dist/pluginmetas/index.js.map +1 -0
- package/dist/plugins/index.d.ts +118 -0
- package/dist/plugins/index.js +247 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/internal/plugin_executeContinueFeed.d.ts +17 -0
- package/dist/plugins/internal/plugin_executeContinueFeed.js +65 -0
- package/dist/plugins/internal/plugin_executeContinueFeed.js.map +1 -0
- package/dist/plugins/internal/plugin_executeNewFeed.d.ts +32 -0
- package/dist/plugins/internal/plugin_executeNewFeed.js +97 -0
- package/dist/plugins/internal/plugin_executeNewFeed.js.map +1 -0
- package/dist/plugins/peer_search.d.ts +65 -0
- package/dist/plugins/peer_search.js +94 -0
- package/dist/plugins/peer_search.js.map +1 -0
- package/dist/plugins/plugin_executeInPlace.d.ts +69 -0
- package/dist/plugins/plugin_executeInPlace.js +66 -0
- package/dist/plugins/plugin_executeInPlace.js.map +1 -0
- package/dist/plugins/plugin_register.d.ts +64 -0
- package/dist/plugins/plugin_register.js +121 -0
- package/dist/plugins/plugin_register.js.map +1 -0
- package/dist/plugins/store_import.d.ts +64 -0
- package/dist/plugins/store_import.js +196 -0
- package/dist/plugins/store_import.js.map +1 -0
- package/dist/store/index.d.ts +15 -0
- package/dist/store/index.js +37 -0
- package/dist/store/index.js.map +1 -0
- package/dist/tags/index.d.ts +21 -0
- package/dist/tags/index.js +37 -0
- package/dist/tags/index.js.map +1 -0
- package/dist/vfs/dispatcher.d.ts +83 -0
- package/dist/vfs/dispatcher.js +192 -0
- package/dist/vfs/dispatcher.js.map +1 -0
- package/dist/vfs/index.d.ts +9 -0
- package/dist/vfs/index.js +26 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/provider.d.ts +80 -0
- package/dist/vfs/provider.js +11 -0
- package/dist/vfs/provider.js.map +1 -0
- package/dist/vfs/providers/etc.d.ts +44 -0
- package/dist/vfs/providers/etc.js +119 -0
- package/dist/vfs/providers/etc.js.map +1 -0
- package/dist/vfs/providers/native.d.ts +34 -0
- package/dist/vfs/providers/native.js +168 -0
- package/dist/vfs/providers/native.js.map +1 -0
- package/dist/vfs/providers/pacs.d.ts +56 -0
- package/dist/vfs/providers/pacs.js +413 -0
- package/dist/vfs/providers/pacs.js.map +1 -0
- package/dist/vfs/providers/pacsHelpers.d.ts +27 -0
- package/dist/vfs/providers/pacsHelpers.js +108 -0
- package/dist/vfs/providers/pacsHelpers.js.map +1 -0
- package/dist/vfs/providers/pacs_content.d.ts +27 -0
- package/dist/vfs/providers/pacs_content.js +137 -0
- package/dist/vfs/providers/pacs_content.js.map +1 -0
- package/dist/vfs/providers/proc.d.ts +62 -0
- package/dist/vfs/providers/proc.js +478 -0
- package/dist/vfs/providers/proc.js.map +1 -0
- package/dist/workflows/index.d.ts +21 -0
- package/dist/workflows/index.js +37 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Job (plugin instance) cancel and delete operations.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Result } from '@fnndsc/cumin';
|
|
7
|
+
/**
|
|
8
|
+
* Cancels a running or scheduled plugin instance.
|
|
9
|
+
* No-op if already terminal (returns Ok).
|
|
10
|
+
*
|
|
11
|
+
* @param instanceID - The plugin instance ID.
|
|
12
|
+
* @returns Ok(true) on success, Err on failure.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const result = await job_cancel(789);
|
|
17
|
+
* if (!result.ok) console.error('Cancel failed');
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function job_cancel(instanceID: number): Promise<Result<boolean>>;
|
|
21
|
+
/**
|
|
22
|
+
* Deletes a plugin instance record from ChRIS.
|
|
23
|
+
* Only call on terminal instances — cancels first if non-terminal.
|
|
24
|
+
*
|
|
25
|
+
* @param instanceID - The plugin instance ID.
|
|
26
|
+
* @returns Ok(true) on success, Err on failure.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const result = await job_delete(789);
|
|
31
|
+
* if (!result.ok) console.error('Delete failed');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function job_delete(instanceID: number): Promise<Result<boolean>>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetches the current status string for a plugin instance directly from the API.
|
|
37
|
+
*
|
|
38
|
+
* @param instanceID - The plugin instance ID.
|
|
39
|
+
* @returns Ok(statusString) or Err on failure.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const result = await job_statusFetch(789);
|
|
44
|
+
* if (result.ok) console.log(result.value); // 'finishedSuccessfully'
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function job_statusFetch(instanceID: number): Promise<Result<string>>;
|
|
48
|
+
/**
|
|
49
|
+
* Finds plugin instances by numeric ID or plugin name substring.
|
|
50
|
+
*
|
|
51
|
+
* Checks ProcCache first. On a miss, queries the API and loads the
|
|
52
|
+
* relevant feed(s) into the cache so paths can be reconstructed.
|
|
53
|
+
*
|
|
54
|
+
* @param term - Numeric instance ID string, or plugin name substring.
|
|
55
|
+
* @returns Ok(array of {id, feedID, pluginName, status}) or Err.
|
|
56
|
+
*
|
|
57
|
+
/**
|
|
58
|
+
* Fetches current status for a batch of plugin instances in parallel.
|
|
59
|
+
* Used by ls -l /proc/jobs/feed_N to get all node statuses in one round-trip.
|
|
60
|
+
*
|
|
61
|
+
* @param ids - Array of instance IDs.
|
|
62
|
+
* @returns Map from instance ID to status string. Missing entries on failure.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const statuses = await jobs_statusBatch([456, 789, 1011]);
|
|
67
|
+
* statuses.get(789); // 'finishedSuccessfully'
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function jobs_statusBatch(ids: number[]): Promise<Map<number, string>>;
|
|
71
|
+
/**
|
|
72
|
+
* Finds plugin instances by numeric ID or plugin name substring.
|
|
73
|
+
* After warm-up completes uses pure in-memory cache; otherwise falls back to API.
|
|
74
|
+
*
|
|
75
|
+
* @param term - Numeric instance ID or plugin name substring.
|
|
76
|
+
* @returns Ok(array of matches) or Err.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* await jobs_find('64306'); // exact ID
|
|
81
|
+
* await jobs_find('pl-fshack'); // all instances whose name contains 'pl-fshack'
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function jobs_find(term: string): Promise<Result<Array<{
|
|
85
|
+
id: number;
|
|
86
|
+
feedID: number;
|
|
87
|
+
pluginName: string;
|
|
88
|
+
}>>>;
|
|
89
|
+
/**
|
|
90
|
+
* Looks up which feed a plugin instance belongs to.
|
|
91
|
+
*
|
|
92
|
+
* @param instanceID - The plugin instance ID.
|
|
93
|
+
* @returns Ok(feedID) or Err if not found.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const r = await job_feedID_get(64306);
|
|
98
|
+
* if (r.ok) console.log(r.value); // 1107
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function job_feedID_get(instanceID: number): Promise<Result<number>>;
|
|
102
|
+
/**
|
|
103
|
+
* Fetches the log output for a plugin instance from the API.
|
|
104
|
+
*
|
|
105
|
+
* @param instanceID - The plugin instance ID.
|
|
106
|
+
* @returns Ok(logString) or Err on failure.
|
|
107
|
+
*/
|
|
108
|
+
export declare function job_logFetch(instanceID: number): Promise<Result<string>>;
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Job (plugin instance) cancel and delete operations.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.job_cancel = job_cancel;
|
|
9
|
+
exports.job_delete = job_delete;
|
|
10
|
+
exports.job_statusFetch = job_statusFetch;
|
|
11
|
+
exports.jobs_statusBatch = jobs_statusBatch;
|
|
12
|
+
exports.jobs_find = jobs_find;
|
|
13
|
+
exports.job_feedID_get = job_feedID_get;
|
|
14
|
+
exports.job_logFetch = job_logFetch;
|
|
15
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
16
|
+
/** Statuses that cannot be cancelled — operation is already done. */
|
|
17
|
+
const TERMINAL_STATUSES = new Set([
|
|
18
|
+
'finishedSuccessfully',
|
|
19
|
+
'finishedWithError',
|
|
20
|
+
'cancelled',
|
|
21
|
+
]);
|
|
22
|
+
/**
|
|
23
|
+
* Cancels a running or scheduled plugin instance.
|
|
24
|
+
* No-op if already terminal (returns Ok).
|
|
25
|
+
*
|
|
26
|
+
* @param instanceID - The plugin instance ID.
|
|
27
|
+
* @returns Ok(true) on success, Err on failure.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const result = await job_cancel(789);
|
|
32
|
+
* if (!result.ok) console.error('Cancel failed');
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
async function job_cancel(instanceID) {
|
|
36
|
+
try {
|
|
37
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
38
|
+
if (!client) {
|
|
39
|
+
cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS.');
|
|
40
|
+
return (0, cumin_1.Err)();
|
|
41
|
+
}
|
|
42
|
+
const instance = await client.getPluginInstance(instanceID);
|
|
43
|
+
if (!instance) {
|
|
44
|
+
cumin_1.errorStack.stack_push('error', `Plugin instance ${instanceID} not found.`);
|
|
45
|
+
return (0, cumin_1.Err)();
|
|
46
|
+
}
|
|
47
|
+
const status = instance.data.status ?? '';
|
|
48
|
+
if (TERMINAL_STATUSES.has(status)) {
|
|
49
|
+
return (0, cumin_1.Ok)(true);
|
|
50
|
+
}
|
|
51
|
+
await instance.put({ status: 'cancelled' });
|
|
52
|
+
return (0, cumin_1.Ok)(true);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
56
|
+
cumin_1.errorStack.stack_push('error', `Failed to cancel instance ${instanceID}: ${msg}`);
|
|
57
|
+
return (0, cumin_1.Err)();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Deletes a plugin instance record from ChRIS.
|
|
62
|
+
* Only call on terminal instances — cancels first if non-terminal.
|
|
63
|
+
*
|
|
64
|
+
* @param instanceID - The plugin instance ID.
|
|
65
|
+
* @returns Ok(true) on success, Err on failure.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const result = await job_delete(789);
|
|
70
|
+
* if (!result.ok) console.error('Delete failed');
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
async function job_delete(instanceID) {
|
|
74
|
+
try {
|
|
75
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
76
|
+
if (!client) {
|
|
77
|
+
cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS.');
|
|
78
|
+
return (0, cumin_1.Err)();
|
|
79
|
+
}
|
|
80
|
+
const instance = await client.getPluginInstance(instanceID);
|
|
81
|
+
if (!instance) {
|
|
82
|
+
cumin_1.errorStack.stack_push('error', `Plugin instance ${instanceID} not found.`);
|
|
83
|
+
return (0, cumin_1.Err)();
|
|
84
|
+
}
|
|
85
|
+
const status = instance.data.status ?? '';
|
|
86
|
+
if (!TERMINAL_STATUSES.has(status)) {
|
|
87
|
+
await instance.put({ status: 'cancelled' });
|
|
88
|
+
}
|
|
89
|
+
await instance.delete();
|
|
90
|
+
return (0, cumin_1.Ok)(true);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
94
|
+
cumin_1.errorStack.stack_push('error', `Failed to delete instance ${instanceID}: ${msg}`);
|
|
95
|
+
return (0, cumin_1.Err)();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Fetches the current status string for a plugin instance directly from the API.
|
|
100
|
+
*
|
|
101
|
+
* @param instanceID - The plugin instance ID.
|
|
102
|
+
* @returns Ok(statusString) or Err on failure.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const result = await job_statusFetch(789);
|
|
107
|
+
* if (result.ok) console.log(result.value); // 'finishedSuccessfully'
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
async function job_statusFetch(instanceID) {
|
|
111
|
+
try {
|
|
112
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
113
|
+
if (!client) {
|
|
114
|
+
cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS.');
|
|
115
|
+
return (0, cumin_1.Err)();
|
|
116
|
+
}
|
|
117
|
+
const instance = await client.getPluginInstance(instanceID);
|
|
118
|
+
if (!instance) {
|
|
119
|
+
cumin_1.errorStack.stack_push('error', `Plugin instance ${instanceID} not found.`);
|
|
120
|
+
return (0, cumin_1.Err)();
|
|
121
|
+
}
|
|
122
|
+
const status = instance.data.status ?? 'unknown';
|
|
123
|
+
return (0, cumin_1.Ok)(status);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
127
|
+
cumin_1.errorStack.stack_push('error', `Failed to fetch status for instance ${instanceID}: ${msg}`);
|
|
128
|
+
return (0, cumin_1.Err)();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Finds plugin instances by numeric ID or plugin name substring.
|
|
133
|
+
*
|
|
134
|
+
* Checks ProcCache first. On a miss, queries the API and loads the
|
|
135
|
+
* relevant feed(s) into the cache so paths can be reconstructed.
|
|
136
|
+
*
|
|
137
|
+
* @param term - Numeric instance ID string, or plugin name substring.
|
|
138
|
+
* @returns Ok(array of {id, feedID, pluginName, status}) or Err.
|
|
139
|
+
*
|
|
140
|
+
/**
|
|
141
|
+
* Fetches current status for a batch of plugin instances in parallel.
|
|
142
|
+
* Used by ls -l /proc/jobs/feed_N to get all node statuses in one round-trip.
|
|
143
|
+
*
|
|
144
|
+
* @param ids - Array of instance IDs.
|
|
145
|
+
* @returns Map from instance ID to status string. Missing entries on failure.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const statuses = await jobs_statusBatch([456, 789, 1011]);
|
|
150
|
+
* statuses.get(789); // 'finishedSuccessfully'
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
async function jobs_statusBatch(ids) {
|
|
154
|
+
const result = new Map();
|
|
155
|
+
if (ids.length === 0)
|
|
156
|
+
return result;
|
|
157
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
158
|
+
if (!client)
|
|
159
|
+
return result;
|
|
160
|
+
const typedClient = client;
|
|
161
|
+
const entries = (await Promise.all(ids.map(async (id) => {
|
|
162
|
+
try {
|
|
163
|
+
const inst = await typedClient.getPluginInstance(id);
|
|
164
|
+
if (!inst)
|
|
165
|
+
return null;
|
|
166
|
+
const status = inst.data.status ?? 'unknown';
|
|
167
|
+
return [id, status];
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}))).filter((e) => e !== null);
|
|
173
|
+
for (const [id, status] of entries) {
|
|
174
|
+
result.set(id, status);
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Finds plugin instances by numeric ID or plugin name substring.
|
|
180
|
+
* After warm-up completes uses pure in-memory cache; otherwise falls back to API.
|
|
181
|
+
*
|
|
182
|
+
* @param term - Numeric instance ID or plugin name substring.
|
|
183
|
+
* @returns Ok(array of matches) or Err.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```typescript
|
|
187
|
+
* await jobs_find('64306'); // exact ID
|
|
188
|
+
* await jobs_find('pl-fshack'); // all instances whose name contains 'pl-fshack'
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
async function jobs_find(term) {
|
|
192
|
+
try {
|
|
193
|
+
const cache = (0, cumin_1.procCache_get)();
|
|
194
|
+
const numeric = parseInt(term, 10);
|
|
195
|
+
const isID = !isNaN(numeric) && String(numeric) === term;
|
|
196
|
+
// After warm-up: topology is complete — pure in-memory, zero API calls.
|
|
197
|
+
if (cache.warmupComplete) {
|
|
198
|
+
const hits = cache.instances_find(term);
|
|
199
|
+
return (0, cumin_1.Ok)(hits.map(i => ({ id: i.id, feedID: i.feedID, pluginName: i.pluginName })));
|
|
200
|
+
}
|
|
201
|
+
// Exact ID: cache-first (only one possible result when warm-up is partial)
|
|
202
|
+
if (isID) {
|
|
203
|
+
const cached = cache.instances_find(term);
|
|
204
|
+
if (cached.length > 0) {
|
|
205
|
+
return (0, cumin_1.Ok)(cached.map(i => ({ id: i.id, feedID: i.feedID, pluginName: i.pluginName })));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Name substring or ID miss: fall back to API during warm-up
|
|
209
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
210
|
+
if (!client) {
|
|
211
|
+
cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS.');
|
|
212
|
+
return (0, cumin_1.Err)();
|
|
213
|
+
}
|
|
214
|
+
const searchParam = isID
|
|
215
|
+
? { id: numeric, limit: 1, offset: 0 }
|
|
216
|
+
: { plugin_name: term, limit: 100, offset: 0 };
|
|
217
|
+
const apiResults = [];
|
|
218
|
+
let offset = 0;
|
|
219
|
+
while (true) {
|
|
220
|
+
const page = await client.getPluginInstances({ ...searchParam, offset });
|
|
221
|
+
const chunk = page.data ?? [];
|
|
222
|
+
for (const inst of chunk) {
|
|
223
|
+
apiResults.push({
|
|
224
|
+
id: Number(inst.id),
|
|
225
|
+
feedID: Number(inst.feed_id),
|
|
226
|
+
pluginName: String(inst.plugin_name),
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
if (isID || chunk.length < 100)
|
|
230
|
+
break;
|
|
231
|
+
offset += 100;
|
|
232
|
+
}
|
|
233
|
+
return (0, cumin_1.Ok)(apiResults);
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
237
|
+
cumin_1.errorStack.stack_push('error', `jobs_find failed: ${msg}`);
|
|
238
|
+
return (0, cumin_1.Err)();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Looks up which feed a plugin instance belongs to.
|
|
243
|
+
*
|
|
244
|
+
* @param instanceID - The plugin instance ID.
|
|
245
|
+
* @returns Ok(feedID) or Err if not found.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* const r = await job_feedID_get(64306);
|
|
250
|
+
* if (r.ok) console.log(r.value); // 1107
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
async function job_feedID_get(instanceID) {
|
|
254
|
+
try {
|
|
255
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
256
|
+
if (!client) {
|
|
257
|
+
cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS.');
|
|
258
|
+
return (0, cumin_1.Err)();
|
|
259
|
+
}
|
|
260
|
+
const result = await client.getPluginInstances({ id: instanceID, limit: 1 });
|
|
261
|
+
const hit = result.data?.[0];
|
|
262
|
+
if (!hit || hit.feed_id === undefined || hit.feed_id === null) {
|
|
263
|
+
cumin_1.errorStack.stack_push('error', `Instance ${instanceID} not found.`);
|
|
264
|
+
return (0, cumin_1.Err)();
|
|
265
|
+
}
|
|
266
|
+
return (0, cumin_1.Ok)(Number(hit.feed_id));
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
270
|
+
cumin_1.errorStack.stack_push('error', `Failed to find feed for instance ${instanceID}: ${msg}`);
|
|
271
|
+
return (0, cumin_1.Err)();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Fetches the log output for a plugin instance from the API.
|
|
276
|
+
*
|
|
277
|
+
* @param instanceID - The plugin instance ID.
|
|
278
|
+
* @returns Ok(logString) or Err on failure.
|
|
279
|
+
*/
|
|
280
|
+
async function job_logFetch(instanceID) {
|
|
281
|
+
try {
|
|
282
|
+
const client = await cumin_1.chrisConnection.client_get();
|
|
283
|
+
if (!client) {
|
|
284
|
+
cumin_1.errorStack.stack_push('error', 'Not connected to ChRIS.');
|
|
285
|
+
return (0, cumin_1.Err)();
|
|
286
|
+
}
|
|
287
|
+
const instance = await client.getPluginInstance(instanceID);
|
|
288
|
+
if (!instance) {
|
|
289
|
+
cumin_1.errorStack.stack_push('error', `Plugin instance ${instanceID} not found.`);
|
|
290
|
+
return (0, cumin_1.Err)();
|
|
291
|
+
}
|
|
292
|
+
if (!instance.getLogs) {
|
|
293
|
+
return (0, cumin_1.Ok)('(log not available for this instance)');
|
|
294
|
+
}
|
|
295
|
+
const logsResult = await instance.getLogs();
|
|
296
|
+
const logText = logsResult.data
|
|
297
|
+
.map((entry) => entry.log ?? '')
|
|
298
|
+
.join('\n');
|
|
299
|
+
return (0, cumin_1.Ok)(logText || '(no log output yet)');
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
303
|
+
cumin_1.errorStack.stack_push('error', `Failed to fetch log for instance ${instanceID}: ${msg}`);
|
|
304
|
+
return (0, cumin_1.Err)();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingUR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AAG,GAAE,CAAC;QACf,CAAC;QAED,MAAM,QAAQ,GAAG,MAAO,MAItB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAEjC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,kBAAU,CAAC,UAAU,CAAC,OAAO,EAAE,mBAAmB,UAAU,aAAa,CAAC,CAAC;YAC3E,OAAO,IAAA,WAAG,GAAE,CAAC;QACf,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACtB,OAAO,IAAA,UAAE,EAAC,uCAAuC,CAAC,CAAC;QACrD,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAW,UAAU,CAAC,IAAI;aACpC,GAAG,CAAC,CAAC,KAAuB,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC;aACjD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,OAAO,IAAA,UAAE,EAAC,OAAO,IAAI,qBAAqB,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,GAAG,GAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3E,kBAAU,CAAC,UAAU,CAAC,OAAO,EAAE,oCAAoC,UAAU,KAAK,GAAG,EAAE,CAAC,CAAC;QACzF,OAAO,IAAA,WAAG,GAAE,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file PACS operations.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { PACSServer, PACSServerListOptions, PACSQueryListOptions, PACSQueryCreateData, PACSRetrieveRecord, PACSQueryStatusReport, Result, FilteredResourceData, PACSQueryRecord, PACSQueryDecodedResult, ListOptions } from "@fnndsc/cumin";
|
|
6
|
+
/**
|
|
7
|
+
* List PACS servers from the connected CUBE.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Optional identifier/limit/offset filters.
|
|
10
|
+
* @returns Result containing PACS servers or Err on failure.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pacsServers_list(options?: PACSServerListOptions): Promise<Result<PACSServer[]>>;
|
|
13
|
+
/**
|
|
14
|
+
* List PACS queries.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Optional filters (pacs_id, pacs_identifier, limit, offset).
|
|
17
|
+
* @returns Result containing FilteredResourceData or null.
|
|
18
|
+
*/
|
|
19
|
+
export declare function pacsQueries_list(options?: PACSQueryListOptions): Promise<Result<FilteredResourceData | null>>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a PACS query against a PACS server.
|
|
22
|
+
*
|
|
23
|
+
* @param pacsserver - PACS server ID or identifier.
|
|
24
|
+
* @param data - Query creation data.
|
|
25
|
+
* @returns Result containing PACSQueryRecord.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pacsQueries_create(pacsserver: string, data: PACSQueryCreateData): Promise<Result<PACSQueryRecord>>;
|
|
28
|
+
/**
|
|
29
|
+
* Decode the result payload of a PACS query.
|
|
30
|
+
*
|
|
31
|
+
* @param queryId - PACS query ID.
|
|
32
|
+
* @returns Result containing decoded payload forms.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pacsQuery_resultDecode(queryId: number): Promise<Result<PACSQueryDecodedResult>>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a PACS retrieve to pull DICOM data from PACS to ChRIS.
|
|
37
|
+
*
|
|
38
|
+
* @param queryId - PACS query ID to retrieve data for.
|
|
39
|
+
* @returns Result containing PACSRetrieveRecord.
|
|
40
|
+
*/
|
|
41
|
+
export declare function pacsRetrieve_create(queryId: number): Promise<Result<PACSRetrieveRecord>>;
|
|
42
|
+
/**
|
|
43
|
+
* List all retrieves for a given PACS query.
|
|
44
|
+
*
|
|
45
|
+
* @param queryId - PACS query ID.
|
|
46
|
+
* @param options - Optional list options.
|
|
47
|
+
* @returns Result containing array of PACSRetrieveRecord.
|
|
48
|
+
*/
|
|
49
|
+
export declare function pacsRetrieves_list(queryId: number, options?: ListOptions): Promise<Result<PACSRetrieveRecord[]>>;
|
|
50
|
+
/**
|
|
51
|
+
* Delete (cancel) a PACS retrieve.
|
|
52
|
+
*
|
|
53
|
+
* @param retrieveId - PACS retrieve ID to delete.
|
|
54
|
+
* @returns Result containing void.
|
|
55
|
+
*/
|
|
56
|
+
export declare function pacsRetrieve_delete(retrieveId: number): Promise<Result<void>>;
|
|
57
|
+
/**
|
|
58
|
+
* Generate a complete status report for a PACS query retrieve.
|
|
59
|
+
* Combines query decode results with actual file counts to show progress.
|
|
60
|
+
*
|
|
61
|
+
* @param queryId - PACS query ID.
|
|
62
|
+
* @returns Result containing PACSQueryStatusReport with series-level status.
|
|
63
|
+
*/
|
|
64
|
+
export declare function pacsRetrieve_statusForQuery(queryId: number): Promise<Result<PACSQueryStatusReport>>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file PACS operations.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.pacsServers_list = pacsServers_list;
|
|
8
|
+
exports.pacsQueries_list = pacsQueries_list;
|
|
9
|
+
exports.pacsQueries_create = pacsQueries_create;
|
|
10
|
+
exports.pacsQuery_resultDecode = pacsQuery_resultDecode;
|
|
11
|
+
exports.pacsRetrieve_create = pacsRetrieve_create;
|
|
12
|
+
exports.pacsRetrieves_list = pacsRetrieves_list;
|
|
13
|
+
exports.pacsRetrieve_delete = pacsRetrieve_delete;
|
|
14
|
+
exports.pacsRetrieve_statusForQuery = pacsRetrieve_statusForQuery;
|
|
15
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
16
|
+
/**
|
|
17
|
+
* List PACS servers from the connected CUBE.
|
|
18
|
+
*
|
|
19
|
+
* @param options - Optional identifier/limit/offset filters.
|
|
20
|
+
* @returns Result containing PACS servers or Err on failure.
|
|
21
|
+
*/
|
|
22
|
+
async function pacsServers_list(options = {}) {
|
|
23
|
+
return (0, cumin_1.pacsServers_list)(options);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List PACS queries.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Optional filters (pacs_id, pacs_identifier, limit, offset).
|
|
29
|
+
* @returns Result containing FilteredResourceData or null.
|
|
30
|
+
*/
|
|
31
|
+
async function pacsQueries_list(options = {}) {
|
|
32
|
+
return (0, cumin_1.pacsQueries_list)(options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a PACS query against a PACS server.
|
|
36
|
+
*
|
|
37
|
+
* @param pacsserver - PACS server ID or identifier.
|
|
38
|
+
* @param data - Query creation data.
|
|
39
|
+
* @returns Result containing PACSQueryRecord.
|
|
40
|
+
*/
|
|
41
|
+
async function pacsQueries_create(pacsserver, data) {
|
|
42
|
+
return (0, cumin_1.pacsQueries_create)(pacsserver, data);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Decode the result payload of a PACS query.
|
|
46
|
+
*
|
|
47
|
+
* @param queryId - PACS query ID.
|
|
48
|
+
* @returns Result containing decoded payload forms.
|
|
49
|
+
*/
|
|
50
|
+
async function pacsQuery_resultDecode(queryId) {
|
|
51
|
+
return (0, cumin_1.pacsQuery_resultDecode)(queryId);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create a PACS retrieve to pull DICOM data from PACS to ChRIS.
|
|
55
|
+
*
|
|
56
|
+
* @param queryId - PACS query ID to retrieve data for.
|
|
57
|
+
* @returns Result containing PACSRetrieveRecord.
|
|
58
|
+
*/
|
|
59
|
+
async function pacsRetrieve_create(queryId) {
|
|
60
|
+
return (0, cumin_1.pacsRetrieve_create)(queryId);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List all retrieves for a given PACS query.
|
|
64
|
+
*
|
|
65
|
+
* @param queryId - PACS query ID.
|
|
66
|
+
* @param options - Optional list options.
|
|
67
|
+
* @returns Result containing array of PACSRetrieveRecord.
|
|
68
|
+
*/
|
|
69
|
+
async function pacsRetrieves_list(queryId, options) {
|
|
70
|
+
return (0, cumin_1.pacsRetrieves_list)(queryId, options);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Delete (cancel) a PACS retrieve.
|
|
74
|
+
*
|
|
75
|
+
* @param retrieveId - PACS retrieve ID to delete.
|
|
76
|
+
* @returns Result containing void.
|
|
77
|
+
*/
|
|
78
|
+
async function pacsRetrieve_delete(retrieveId) {
|
|
79
|
+
return (0, cumin_1.pacsRetrieve_delete)(retrieveId);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Generate a complete status report for a PACS query retrieve.
|
|
83
|
+
* Combines query decode results with actual file counts to show progress.
|
|
84
|
+
*
|
|
85
|
+
* @param queryId - PACS query ID.
|
|
86
|
+
* @returns Result containing PACSQueryStatusReport with series-level status.
|
|
87
|
+
*/
|
|
88
|
+
async function pacsRetrieve_statusForQuery(queryId) {
|
|
89
|
+
return (0, cumin_1.pacsRetrieve_statusForQuery)(queryId);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pacs/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA8BH,4CAIC;AAQD,4CAIC;AASD,gDAKC;AAQD,wDAIC;AAQD,kDAIC;AASD,gDAKC;AAQD,kDAIC;AASD,kEAIC;AAzHD,yCAoBuB;AAEvB;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CACpC,UAAiC,EAAE;IAEnC,OAAO,IAAA,wBAAsB,EAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CACpC,UAAgC,EAAE;IAElC,OAAO,IAAA,wBAAsB,EAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,UAAkB,EAClB,IAAyB;IAEzB,OAAO,IAAA,0BAAwB,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAAe;IAEf,OAAO,IAAA,8BAA4B,EAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,mBAAmB,CACvC,OAAe;IAEf,OAAO,IAAA,2BAAyB,EAAC,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,OAAe,EACf,OAAqB;IAErB,OAAO,IAAA,0BAAwB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,mBAAmB,CACvC,UAAkB;IAElB,OAAO,IAAA,2BAAyB,EAAC,UAAU,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,2BAA2B,CAC/C,OAAe;IAEf,OAAO,IAAA,mCAAiC,EAAC,OAAO,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Thin salsa wrapper around cumin's PACS query result decoder.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { PACSQueryDecodedResult, Result } from "@fnndsc/cumin";
|
|
7
|
+
/**
|
|
8
|
+
* Decode the result payload of a PACS query by ID.
|
|
9
|
+
*
|
|
10
|
+
* @param queryId - PACS query ID.
|
|
11
|
+
* @returns Result containing decoded payload (raw, decoded buffers/text/json) or Err.
|
|
12
|
+
*/
|
|
13
|
+
export declare function pacsQuery_resultDecode(queryId: number): Promise<Result<PACSQueryDecodedResult>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Thin salsa wrapper around cumin's PACS query result decoder.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.pacsQuery_resultDecode = pacsQuery_resultDecode;
|
|
9
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
10
|
+
/**
|
|
11
|
+
* Decode the result payload of a PACS query by ID.
|
|
12
|
+
*
|
|
13
|
+
* @param queryId - PACS query ID.
|
|
14
|
+
* @returns Result containing decoded payload (raw, decoded buffers/text/json) or Err.
|
|
15
|
+
*/
|
|
16
|
+
async function pacsQuery_resultDecode(queryId) {
|
|
17
|
+
return (0, cumin_1.pacsQuery_resultDecode)(queryId);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=resultDecode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultDecode.js","sourceRoot":"","sources":["../../src/pacs/resultDecode.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAUH,wDAIC;AAZD,yCAAuH;AAEvH;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAAe;IAEf,OAAO,IAAA,8BAA4B,EAAC,OAAO,CAAC,CAAC;AAC/C,CAAC"}
|