@fnndsc/chili 3.2.5

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 (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +113 -0
  3. package/dist/chefs/chefs.d.ts +15 -0
  4. package/dist/chefs/chefs.js +195 -0
  5. package/dist/commands/compute/fields.d.ts +6 -0
  6. package/dist/commands/compute/fields.js +13 -0
  7. package/dist/commands/compute/list.d.ts +19 -0
  8. package/dist/commands/compute/list.js +20 -0
  9. package/dist/commands/connect/login.d.ts +16 -0
  10. package/dist/commands/connect/login.js +18 -0
  11. package/dist/commands/connect/logout.d.ts +6 -0
  12. package/dist/commands/connect/logout.js +16 -0
  13. package/dist/commands/feed/comments.d.ts +41 -0
  14. package/dist/commands/feed/comments.js +45 -0
  15. package/dist/commands/feed/create.d.ts +13 -0
  16. package/dist/commands/feed/create.js +40 -0
  17. package/dist/commands/feed/note.d.ts +21 -0
  18. package/dist/commands/feed/note.js +24 -0
  19. package/dist/commands/feeds/delete.d.ts +14 -0
  20. package/dist/commands/feeds/delete.js +34 -0
  21. package/dist/commands/feeds/fields.d.ts +6 -0
  22. package/dist/commands/feeds/fields.js +17 -0
  23. package/dist/commands/feeds/list.d.ts +17 -0
  24. package/dist/commands/feeds/list.js +38 -0
  25. package/dist/commands/feeds/share.d.ts +17 -0
  26. package/dist/commands/feeds/share.js +19 -0
  27. package/dist/commands/file/view.d.ts +8 -0
  28. package/dist/commands/file/view.js +25 -0
  29. package/dist/commands/files/delete.d.ts +16 -0
  30. package/dist/commands/files/delete.js +36 -0
  31. package/dist/commands/files/fields.d.ts +7 -0
  32. package/dist/commands/files/fields.js +18 -0
  33. package/dist/commands/files/list.d.ts +11 -0
  34. package/dist/commands/files/list.js +23 -0
  35. package/dist/commands/fs/cat.d.ts +15 -0
  36. package/dist/commands/fs/cat.js +26 -0
  37. package/dist/commands/fs/cp.d.ts +17 -0
  38. package/dist/commands/fs/cp.js +26 -0
  39. package/dist/commands/fs/create.d.ts +15 -0
  40. package/dist/commands/fs/create.js +83 -0
  41. package/dist/commands/fs/download.d.ts +25 -0
  42. package/dist/commands/fs/download.js +235 -0
  43. package/dist/commands/fs/edit.d.ts +16 -0
  44. package/dist/commands/fs/edit.js +25 -0
  45. package/dist/commands/fs/ls.d.ts +18 -0
  46. package/dist/commands/fs/ls.js +142 -0
  47. package/dist/commands/fs/mkdir.d.ts +8 -0
  48. package/dist/commands/fs/mkdir.js +21 -0
  49. package/dist/commands/fs/mv.d.ts +13 -0
  50. package/dist/commands/fs/mv.js +73 -0
  51. package/dist/commands/fs/rm.d.ts +24 -0
  52. package/dist/commands/fs/rm.js +108 -0
  53. package/dist/commands/fs/touch.d.ts +16 -0
  54. package/dist/commands/fs/touch.js +62 -0
  55. package/dist/commands/fs/upload.d.ts +55 -0
  56. package/dist/commands/fs/upload.js +221 -0
  57. package/dist/commands/groups/fields.d.ts +6 -0
  58. package/dist/commands/groups/fields.js +13 -0
  59. package/dist/commands/groups/list.d.ts +16 -0
  60. package/dist/commands/groups/list.js +26 -0
  61. package/dist/commands/man/doc.d.ts +16 -0
  62. package/dist/commands/man/doc.js +32 -0
  63. package/dist/commands/man/topics.d.ts +6 -0
  64. package/dist/commands/man/topics.js +27 -0
  65. package/dist/commands/pipeline/fields.d.ts +6 -0
  66. package/dist/commands/pipeline/fields.js +13 -0
  67. package/dist/commands/pipeline/run.d.ts +18 -0
  68. package/dist/commands/pipeline/run.js +33 -0
  69. package/dist/commands/plugin/readme.d.ts +14 -0
  70. package/dist/commands/plugin/readme.js +49 -0
  71. package/dist/commands/plugin/run.d.ts +10 -0
  72. package/dist/commands/plugin/run.js +29 -0
  73. package/dist/commands/plugin/search.d.ts +7 -0
  74. package/dist/commands/plugin/search.js +18 -0
  75. package/dist/commands/plugininstances/fields.d.ts +6 -0
  76. package/dist/commands/plugininstances/fields.js +13 -0
  77. package/dist/commands/plugininstances/list.d.ts +16 -0
  78. package/dist/commands/plugininstances/list.js +26 -0
  79. package/dist/commands/pluginmetas/fields.d.ts +6 -0
  80. package/dist/commands/pluginmetas/fields.js +13 -0
  81. package/dist/commands/pluginmetas/list.d.ts +16 -0
  82. package/dist/commands/pluginmetas/list.js +26 -0
  83. package/dist/commands/plugins/add.d.ts +34 -0
  84. package/dist/commands/plugins/add.js +374 -0
  85. package/dist/commands/plugins/delete.d.ts +14 -0
  86. package/dist/commands/plugins/delete.js +34 -0
  87. package/dist/commands/plugins/fields.d.ts +6 -0
  88. package/dist/commands/plugins/fields.js +17 -0
  89. package/dist/commands/plugins/list.d.ts +17 -0
  90. package/dist/commands/plugins/list.js +40 -0
  91. package/dist/commands/plugins/overview.d.ts +6 -0
  92. package/dist/commands/plugins/overview.js +17 -0
  93. package/dist/commands/store/list.d.ts +23 -0
  94. package/dist/commands/store/list.js +48 -0
  95. package/dist/commands/tags/fields.d.ts +6 -0
  96. package/dist/commands/tags/fields.js +13 -0
  97. package/dist/commands/tags/list.d.ts +16 -0
  98. package/dist/commands/tags/list.js +26 -0
  99. package/dist/commands/workflows/fields.d.ts +6 -0
  100. package/dist/commands/workflows/fields.js +13 -0
  101. package/dist/commands/workflows/list.d.ts +16 -0
  102. package/dist/commands/workflows/list.js +26 -0
  103. package/dist/config/colorConfig.d.ts +56 -0
  104. package/dist/config/colorConfig.js +161 -0
  105. package/dist/connect/connectHandler.d.ts +15 -0
  106. package/dist/connect/connectHandler.js +48 -0
  107. package/dist/context/contextCommand.d.ts +13 -0
  108. package/dist/context/contextCommand.js +193 -0
  109. package/dist/controllers/baseController.d.ts +43 -0
  110. package/dist/controllers/baseController.js +67 -0
  111. package/dist/controllers/feedController.d.ts +35 -0
  112. package/dist/controllers/feedController.js +53 -0
  113. package/dist/controllers/fileController.d.ts +56 -0
  114. package/dist/controllers/fileController.js +93 -0
  115. package/dist/controllers/pluginContextController.d.ts +24 -0
  116. package/dist/controllers/pluginContextController.js +49 -0
  117. package/dist/controllers/pluginController.d.ts +70 -0
  118. package/dist/controllers/pluginController.js +98 -0
  119. package/dist/controllers/pluginMetaController.d.ts +41 -0
  120. package/dist/controllers/pluginMetaController.js +52 -0
  121. package/dist/feeds/feedHandler.d.ts +64 -0
  122. package/dist/feeds/feedHandler.js +203 -0
  123. package/dist/filesystem/fileGroupHandler.d.ts +92 -0
  124. package/dist/filesystem/fileGroupHandler.js +318 -0
  125. package/dist/filesystem/filesystemHandler.d.ts +12 -0
  126. package/dist/filesystem/filesystemHandler.js +135 -0
  127. package/dist/filesystem/inodeCommand.d.ts +12 -0
  128. package/dist/filesystem/inodeCommand.js +37 -0
  129. package/dist/handlers/baseGroupHandler.d.ts +103 -0
  130. package/dist/handlers/baseGroupHandler.js +342 -0
  131. package/dist/index.d.ts +7 -0
  132. package/dist/index.js +239 -0
  133. package/dist/lfs/lfs.d.ts +25 -0
  134. package/dist/lfs/lfs.js +74 -0
  135. package/dist/man/man.d.ts +15 -0
  136. package/dist/man/man.js +31 -0
  137. package/dist/man/renderer.d.ts +26 -0
  138. package/dist/man/renderer.js +187 -0
  139. package/dist/models/feed.d.ts +18 -0
  140. package/dist/models/feed.js +8 -0
  141. package/dist/models/listing.d.ts +33 -0
  142. package/dist/models/listing.js +9 -0
  143. package/dist/models/plugin.d.ts +27 -0
  144. package/dist/models/plugin.js +1 -0
  145. package/dist/models/resource.d.ts +39 -0
  146. package/dist/models/resource.js +9 -0
  147. package/dist/pacs/pacsQueryHandler.d.ts +55 -0
  148. package/dist/pacs/pacsQueryHandler.js +196 -0
  149. package/dist/pacs/pacsQueryPayload.d.ts +19 -0
  150. package/dist/pacs/pacsQueryPayload.js +44 -0
  151. package/dist/pacs/pacsResultRender.d.ts +20 -0
  152. package/dist/pacs/pacsResultRender.js +141 -0
  153. package/dist/pacs/pacsRetrieveHandler.d.ts +87 -0
  154. package/dist/pacs/pacsRetrieveHandler.js +272 -0
  155. package/dist/pacs/pacsServerHandler.d.ts +15 -0
  156. package/dist/pacs/pacsServerHandler.js +32 -0
  157. package/dist/path/pathCommand.d.ts +64 -0
  158. package/dist/path/pathCommand.js +805 -0
  159. package/dist/path/pathMapper.d.ts +189 -0
  160. package/dist/path/pathMapper.js +382 -0
  161. package/dist/plugins/pluginGroupHandler.d.ts +42 -0
  162. package/dist/plugins/pluginGroupHandler.js +90 -0
  163. package/dist/plugins/pluginHandler.d.ts +87 -0
  164. package/dist/plugins/pluginHandler.js +303 -0
  165. package/dist/plugins/pluginMetaHandler.d.ts +21 -0
  166. package/dist/plugins/pluginMetaHandler.js +27 -0
  167. package/dist/screen/screen.d.ts +214 -0
  168. package/dist/screen/screen.js +478 -0
  169. package/dist/utils/admin_prompt.d.ts +42 -0
  170. package/dist/utils/admin_prompt.js +105 -0
  171. package/dist/utils/cli.d.ts +67 -0
  172. package/dist/utils/cli.js +112 -0
  173. package/dist/utils/docker.d.ts +74 -0
  174. package/dist/utils/docker.js +155 -0
  175. package/dist/utils/input_format.d.ts +77 -0
  176. package/dist/utils/input_format.js +135 -0
  177. package/dist/utils/sort.d.ts +29 -0
  178. package/dist/utils/sort.js +63 -0
  179. package/dist/utils/ui.d.ts +7 -0
  180. package/dist/utils/ui.js +26 -0
  181. package/dist/utils.d.ts +15 -0
  182. package/dist/utils.js +14 -0
  183. package/dist/views/compute.d.ts +17 -0
  184. package/dist/views/compute.js +40 -0
  185. package/dist/views/connect.d.ts +13 -0
  186. package/dist/views/connect.js +35 -0
  187. package/dist/views/feed.d.ts +44 -0
  188. package/dist/views/feed.js +110 -0
  189. package/dist/views/file.d.ts +25 -0
  190. package/dist/views/file.js +71 -0
  191. package/dist/views/fs.d.ts +51 -0
  192. package/dist/views/fs.js +105 -0
  193. package/dist/views/ls.d.ts +37 -0
  194. package/dist/views/ls.js +190 -0
  195. package/dist/views/plugin.d.ts +28 -0
  196. package/dist/views/plugin.js +71 -0
  197. package/dist/views/pluginParameters.d.ts +17 -0
  198. package/dist/views/pluginParameters.js +79 -0
  199. package/docs/00_intro.adoc +25 -0
  200. package/docs/01_setup.adoc +63 -0
  201. package/docs/02_context.adoc +128 -0
  202. package/docs/03_searchable.adoc +134 -0
  203. package/docs/10_everyday_examples.adoc +9 -0
  204. package/docs/11_upload_data.adoc +146 -0
  205. package/docs/12_create_a_feed.adoc +9 -0
  206. package/docs/13_run_a_plugin.adoc +271 -0
  207. package/docs/20_plugins.adoc +16 -0
  208. package/docs/21_pluginReadme.adoc +123 -0
  209. package/docs/30_filesystem.adoc +93 -0
  210. package/docs/31_fileops.adoc +51 -0
  211. package/docs/32_file_content.adoc +471 -0
  212. package/docs/_architecture.adoc +48 -0
  213. package/docs/_deepContext.adoc +84 -0
  214. package/docs/_roadmap.adoc +42 -0
  215. package/docs/_searchable.adoc +187 -0
  216. package/docs/_state.adoc +68 -0
  217. package/docs/pacs.adoc +101 -0
  218. package/docs/pathMapper.md +246 -0
  219. package/package.json +92 -0
@@ -0,0 +1,272 @@
1
+ /**
2
+ * @file Handler for the PACS retrieve command group.
3
+ *
4
+ * @module
5
+ */
6
+ import { errorStack_getAllOfType, } from "@fnndsc/cumin";
7
+ import { pacsRetrieve_create, pacsRetrieve_delete, pacsRetrieve_statusForQuery, } from "@fnndsc/salsa";
8
+ import { border_draw } from "../screen/screen.js";
9
+ /**
10
+ * Handler for PACS retrieve commands.
11
+ */
12
+ export class PACSRetrieveGroupHandler {
13
+ constructor() {
14
+ this.assetName = "pacsretrieve";
15
+ }
16
+ /**
17
+ * Setup PACS retrieve commands on the parent command.
18
+ *
19
+ * @param program - Commander program instance.
20
+ */
21
+ pacsRetrieveCommand_setup(program) {
22
+ const pacsRetrieveCommand = program
23
+ .command(this.assetName)
24
+ .description("Manage PACS retrieves (pull DICOM data from PACS to ChRIS)");
25
+ // pull command
26
+ pacsRetrieveCommand
27
+ .command("pull <queryId>")
28
+ .description("Trigger a PACS retrieve to pull DICOM data for a query")
29
+ .action(async (queryIdStr) => {
30
+ await this.retrieve_pull(queryIdStr);
31
+ });
32
+ // report command
33
+ pacsRetrieveCommand
34
+ .command("report <queryId>")
35
+ .description("Show detailed status report for a query retrieve")
36
+ .action(async (queryIdStr) => {
37
+ await this.retrieve_report(queryIdStr);
38
+ });
39
+ // cancel command
40
+ pacsRetrieveCommand
41
+ .command("cancel <retrieveId>")
42
+ .description("Cancel (delete) a PACS retrieve")
43
+ .action(async (retrieveIdStr) => {
44
+ await this.retrieve_cancel(retrieveIdStr);
45
+ });
46
+ }
47
+ /**
48
+ * Handle the 'pull' command - create a new retrieve.
49
+ *
50
+ * @param queryIdStr - Query ID as string.
51
+ */
52
+ async retrieve_pull(queryIdStr) {
53
+ const queryId = Number(queryIdStr);
54
+ if (Number.isNaN(queryId)) {
55
+ console.log(border_draw("Query ID must be a number."));
56
+ return;
57
+ }
58
+ const result = await pacsRetrieve_create(queryId);
59
+ if (!result.ok) {
60
+ const errors = errorStack_getAllOfType("error");
61
+ if (errors.length) {
62
+ errors.forEach((msg) => console.log(border_draw(msg)));
63
+ }
64
+ else {
65
+ console.log(border_draw(`Failed to create PACS retrieve for query ${queryId}.`));
66
+ }
67
+ return;
68
+ }
69
+ const record = result.value;
70
+ const msg = [
71
+ "Created PACS retrieve",
72
+ `id=${record.id}`,
73
+ `query=${queryId}`,
74
+ `status=${record.status || "created"}`,
75
+ ].join(" ");
76
+ console.log(border_draw(msg));
77
+ }
78
+ /**
79
+ * Handle the 'report' command - show detailed status.
80
+ *
81
+ * @param queryIdStr - Query ID as string.
82
+ */
83
+ async retrieve_report(queryIdStr) {
84
+ const queryId = Number(queryIdStr);
85
+ if (Number.isNaN(queryId)) {
86
+ console.log(border_draw("Query ID must be a number."));
87
+ return;
88
+ }
89
+ const result = await pacsRetrieve_statusForQuery(queryId);
90
+ if (!result.ok) {
91
+ const errors = errorStack_getAllOfType("error");
92
+ if (errors.length) {
93
+ errors.forEach((msg) => console.log(border_draw(msg)));
94
+ }
95
+ else {
96
+ console.log(border_draw(`Failed to generate status report for query ${queryId}.`));
97
+ }
98
+ return;
99
+ }
100
+ const report = result.value;
101
+ const rendered = this.report_render(report);
102
+ console.log(border_draw(rendered));
103
+ }
104
+ /**
105
+ * Handle the 'cancel' command - delete a retrieve.
106
+ *
107
+ * @param retrieveIdStr - Retrieve ID as string.
108
+ */
109
+ async retrieve_cancel(retrieveIdStr) {
110
+ const retrieveId = Number(retrieveIdStr);
111
+ if (Number.isNaN(retrieveId)) {
112
+ console.log(border_draw("Retrieve ID must be a number."));
113
+ return;
114
+ }
115
+ const result = await pacsRetrieve_delete(retrieveId);
116
+ if (!result.ok) {
117
+ const errors = errorStack_getAllOfType("error");
118
+ if (errors.length) {
119
+ errors.forEach((msg) => console.log(border_draw(msg)));
120
+ }
121
+ else {
122
+ console.log(border_draw(`Failed to cancel PACS retrieve ${retrieveId}.`));
123
+ }
124
+ return;
125
+ }
126
+ console.log(border_draw(`PACS retrieve ${retrieveId} cancelled.`));
127
+ }
128
+ /**
129
+ * Determine overall completion status from series statuses.
130
+ *
131
+ * @param report - The status report.
132
+ * @returns True if all series are pulled.
133
+ */
134
+ allSeries_arePulled(report) {
135
+ if (report.studies.length === 0) {
136
+ return false;
137
+ }
138
+ for (const study of report.studies) {
139
+ for (const series of study.series) {
140
+ if (series.status !== "pulled") {
141
+ return false;
142
+ }
143
+ }
144
+ }
145
+ return true;
146
+ }
147
+ /**
148
+ * Render a status report into a human-readable string.
149
+ *
150
+ * @param report - The status report.
151
+ * @returns Formatted string.
152
+ */
153
+ report_render(report) {
154
+ const lines = [];
155
+ lines.push(`Query ID: ${report.queryId}`);
156
+ if (report.retrieveId !== undefined) {
157
+ lines.push(`Retrieve ID: ${report.retrieveId}`);
158
+ // Check if all series are actually pulled (more accurate than retrieve record status)
159
+ const allPulled = this.allSeries_arePulled(report);
160
+ const displayStatus = allPulled
161
+ ? "Completed"
162
+ : this.status_mapToDisplay(report.retrieveStatus || "unknown");
163
+ lines.push(`Retrieve Status: ${displayStatus}`);
164
+ }
165
+ else {
166
+ lines.push("Retrieve Status: No retrieve created yet");
167
+ }
168
+ lines.push("");
169
+ if (report.studies.length === 0) {
170
+ lines.push("No studies found in query result.");
171
+ return lines.join("\n");
172
+ }
173
+ report.studies.forEach((study, idx) => {
174
+ this.study_renderTo(study, idx + 1, lines);
175
+ });
176
+ return lines.join("\n");
177
+ }
178
+ /**
179
+ * Extract value from a DICOM tag object or return as-is.
180
+ *
181
+ * @param val - Potentially a tag object with {label, value} or a primitive.
182
+ * @returns The extracted value.
183
+ */
184
+ tagValue_extract(val) {
185
+ if (val && typeof val === "object" && "value" in val) {
186
+ const tagObj = val;
187
+ return String(tagObj.value ?? "");
188
+ }
189
+ return String(val ?? "");
190
+ }
191
+ /**
192
+ * Render a single study to the lines array.
193
+ *
194
+ * @param study - Study status.
195
+ * @param studyNum - Study number (1-indexed).
196
+ * @param lines - Output lines array.
197
+ */
198
+ study_renderTo(study, studyNum, lines) {
199
+ lines.push(`Study ${studyNum}`);
200
+ const studyDesc = this.tagValue_extract(study.studyDescription);
201
+ const studyUID = this.tagValue_extract(study.studyInstanceUID);
202
+ if (studyDesc) {
203
+ lines.push(` Description: ${studyDesc}`);
204
+ }
205
+ if (studyUID) {
206
+ lines.push(` UID: ${studyUID}`);
207
+ }
208
+ if (study.series.length === 0) {
209
+ lines.push(" No series found.");
210
+ lines.push("");
211
+ return;
212
+ }
213
+ study.series.forEach((series, idx) => {
214
+ this.series_renderTo(series, idx + 1, lines);
215
+ });
216
+ lines.push("");
217
+ }
218
+ /**
219
+ * Render a single series to the lines array.
220
+ *
221
+ * @param series - Series status.
222
+ * @param seriesNum - Series number (1-indexed).
223
+ * @param lines - Output lines array.
224
+ */
225
+ series_renderTo(series, seriesNum, lines) {
226
+ const seriesDesc = this.tagValue_extract(series.seriesDescription);
227
+ const description = seriesDesc || `Series ${seriesNum}`;
228
+ const statusDisplay = this.series_statusDisplay(series);
229
+ lines.push(` ${description}: ${statusDisplay}`);
230
+ }
231
+ /**
232
+ * Generate display string for series status.
233
+ *
234
+ * @param series - Series status.
235
+ * @returns Display string.
236
+ */
237
+ series_statusDisplay(series) {
238
+ const { status, actualFiles, expectedFiles } = series;
239
+ switch (status) {
240
+ case "pending":
241
+ return `Pending (0/${expectedFiles} images)`;
242
+ case "pulling":
243
+ return `Pulling (${actualFiles}/${expectedFiles} images)`;
244
+ case "pulled":
245
+ return `Pulled (${actualFiles} images)`;
246
+ case "error":
247
+ return `Error (${actualFiles}/${expectedFiles} images - count mismatch)`;
248
+ default:
249
+ return `Unknown (${actualFiles}/${expectedFiles} images)`;
250
+ }
251
+ }
252
+ /**
253
+ * Map retrieve status to display string.
254
+ *
255
+ * @param status - Raw status string.
256
+ * @returns Display-friendly status.
257
+ */
258
+ status_mapToDisplay(status) {
259
+ switch (status) {
260
+ case "created":
261
+ return "Pending";
262
+ case "sent":
263
+ return "Retrieving";
264
+ case "succeeded":
265
+ return "Completed";
266
+ case "errored":
267
+ return "Failed";
268
+ default:
269
+ return status;
270
+ }
271
+ }
272
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file Handler for the PACS server command group.
3
+ *
4
+ * @module
5
+ */
6
+ import { Command } from "commander";
7
+ /**
8
+ * Command-group handler for PACS server operations.
9
+ */
10
+ export declare class PACSServerGroupHandler {
11
+ private baseGroupHandler;
12
+ private assetName;
13
+ constructor();
14
+ pacsServerCommand_setup(program: Command): void;
15
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file Handler for the PACS server command group.
3
+ *
4
+ * @module
5
+ */
6
+ import { ChRISPACSGroup } from "@fnndsc/cumin";
7
+ import { BaseGroupHandler } from "../handlers/baseGroupHandler.js";
8
+ /**
9
+ * Command-group handler for PACS server operations.
10
+ */
11
+ export class PACSServerGroupHandler {
12
+ constructor() {
13
+ this.assetName = "pacsservers";
14
+ const chrisObject = new ChRISPACSGroup();
15
+ this.baseGroupHandler = new BaseGroupHandler(this.assetName, chrisObject);
16
+ }
17
+ pacsServerCommand_setup(program) {
18
+ const pacsServerCommand = program
19
+ .command(this.assetName)
20
+ .description("Interact with PACS servers");
21
+ const listCommand = this.baseGroupHandler.baseListCommand_create(async (options) => {
22
+ await this.baseGroupHandler.resources_list(options);
23
+ });
24
+ pacsServerCommand.addCommand(listCommand);
25
+ pacsServerCommand
26
+ .command("fieldslist")
27
+ .description(`list the ${this.assetName} resource fields`)
28
+ .action(async () => {
29
+ await this.baseGroupHandler.resourceFields_list();
30
+ });
31
+ }
32
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @file Path scan/transfer commands and the recursive ChRIS path scanner.
3
+ *
4
+ * @module
5
+ */
6
+ import { Command } from "commander";
7
+ interface FileInfo {
8
+ id: number;
9
+ hostPath: string;
10
+ chrisPath: string;
11
+ size: number;
12
+ isLink: boolean;
13
+ linkTarget: string;
14
+ isDirectory: boolean;
15
+ }
16
+ /**
17
+ * Aggregated result of a recursive ChRIS path scan.
18
+ */
19
+ export interface ScanRecord {
20
+ fileInfo: FileInfo[];
21
+ totalSize: number;
22
+ }
23
+ /**
24
+ * CLI options controlling a path scan or transfer.
25
+ */
26
+ export interface CLIscan {
27
+ tree?: boolean;
28
+ follow?: boolean;
29
+ silent?: boolean;
30
+ hostpath?: string;
31
+ dirsOnly?: boolean;
32
+ filter?: string;
33
+ endsWith?: string;
34
+ mermaid?: boolean;
35
+ save?: string;
36
+ }
37
+ /**
38
+ * Creates an Archy-formatted tree structure from file information.
39
+ *
40
+ * @param files - An array of FileInfo objects.
41
+ * @returns The Archy-formatted tree string.
42
+ */
43
+ export declare function archyTree_create(files: FileInfo[]): string;
44
+ /**
45
+ * Performs a recursive scan of the current ChRIS folder.
46
+ *
47
+ * @param options - Scan options.
48
+ * @returns The scan record, or null if no context is set.
49
+ */
50
+ export declare function scan_do(options: CLIscan): Promise<ScanRecord | null>;
51
+ /**
52
+ * Formats a number of bytes into a human-readable string.
53
+ *
54
+ * @param bytes - The number of bytes.
55
+ * @returns A formatted string (e.g., "1.23 MB").
56
+ */
57
+ export declare function bytes_format(bytes: number): string;
58
+ /**
59
+ * Sets up the 'path' command for performing operations on ChRIS paths.
60
+ *
61
+ * @param program - The Commander.js program instance.
62
+ */
63
+ export declare function pathCommand_setup(program: Command): Promise<void>;
64
+ export {};