@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.
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/chefs/chefs.d.ts +15 -0
- package/dist/chefs/chefs.js +195 -0
- package/dist/commands/compute/fields.d.ts +6 -0
- package/dist/commands/compute/fields.js +13 -0
- package/dist/commands/compute/list.d.ts +19 -0
- package/dist/commands/compute/list.js +20 -0
- package/dist/commands/connect/login.d.ts +16 -0
- package/dist/commands/connect/login.js +18 -0
- package/dist/commands/connect/logout.d.ts +6 -0
- package/dist/commands/connect/logout.js +16 -0
- package/dist/commands/feed/comments.d.ts +41 -0
- package/dist/commands/feed/comments.js +45 -0
- package/dist/commands/feed/create.d.ts +13 -0
- package/dist/commands/feed/create.js +40 -0
- package/dist/commands/feed/note.d.ts +21 -0
- package/dist/commands/feed/note.js +24 -0
- package/dist/commands/feeds/delete.d.ts +14 -0
- package/dist/commands/feeds/delete.js +34 -0
- package/dist/commands/feeds/fields.d.ts +6 -0
- package/dist/commands/feeds/fields.js +17 -0
- package/dist/commands/feeds/list.d.ts +17 -0
- package/dist/commands/feeds/list.js +38 -0
- package/dist/commands/feeds/share.d.ts +17 -0
- package/dist/commands/feeds/share.js +19 -0
- package/dist/commands/file/view.d.ts +8 -0
- package/dist/commands/file/view.js +25 -0
- package/dist/commands/files/delete.d.ts +16 -0
- package/dist/commands/files/delete.js +36 -0
- package/dist/commands/files/fields.d.ts +7 -0
- package/dist/commands/files/fields.js +18 -0
- package/dist/commands/files/list.d.ts +11 -0
- package/dist/commands/files/list.js +23 -0
- package/dist/commands/fs/cat.d.ts +15 -0
- package/dist/commands/fs/cat.js +26 -0
- package/dist/commands/fs/cp.d.ts +17 -0
- package/dist/commands/fs/cp.js +26 -0
- package/dist/commands/fs/create.d.ts +15 -0
- package/dist/commands/fs/create.js +83 -0
- package/dist/commands/fs/download.d.ts +25 -0
- package/dist/commands/fs/download.js +235 -0
- package/dist/commands/fs/edit.d.ts +16 -0
- package/dist/commands/fs/edit.js +25 -0
- package/dist/commands/fs/ls.d.ts +18 -0
- package/dist/commands/fs/ls.js +142 -0
- package/dist/commands/fs/mkdir.d.ts +8 -0
- package/dist/commands/fs/mkdir.js +21 -0
- package/dist/commands/fs/mv.d.ts +13 -0
- package/dist/commands/fs/mv.js +73 -0
- package/dist/commands/fs/rm.d.ts +24 -0
- package/dist/commands/fs/rm.js +108 -0
- package/dist/commands/fs/touch.d.ts +16 -0
- package/dist/commands/fs/touch.js +62 -0
- package/dist/commands/fs/upload.d.ts +55 -0
- package/dist/commands/fs/upload.js +221 -0
- package/dist/commands/groups/fields.d.ts +6 -0
- package/dist/commands/groups/fields.js +13 -0
- package/dist/commands/groups/list.d.ts +16 -0
- package/dist/commands/groups/list.js +26 -0
- package/dist/commands/man/doc.d.ts +16 -0
- package/dist/commands/man/doc.js +32 -0
- package/dist/commands/man/topics.d.ts +6 -0
- package/dist/commands/man/topics.js +27 -0
- package/dist/commands/pipeline/fields.d.ts +6 -0
- package/dist/commands/pipeline/fields.js +13 -0
- package/dist/commands/pipeline/run.d.ts +18 -0
- package/dist/commands/pipeline/run.js +33 -0
- package/dist/commands/plugin/readme.d.ts +14 -0
- package/dist/commands/plugin/readme.js +49 -0
- package/dist/commands/plugin/run.d.ts +10 -0
- package/dist/commands/plugin/run.js +29 -0
- package/dist/commands/plugin/search.d.ts +7 -0
- package/dist/commands/plugin/search.js +18 -0
- package/dist/commands/plugininstances/fields.d.ts +6 -0
- package/dist/commands/plugininstances/fields.js +13 -0
- package/dist/commands/plugininstances/list.d.ts +16 -0
- package/dist/commands/plugininstances/list.js +26 -0
- package/dist/commands/pluginmetas/fields.d.ts +6 -0
- package/dist/commands/pluginmetas/fields.js +13 -0
- package/dist/commands/pluginmetas/list.d.ts +16 -0
- package/dist/commands/pluginmetas/list.js +26 -0
- package/dist/commands/plugins/add.d.ts +34 -0
- package/dist/commands/plugins/add.js +374 -0
- package/dist/commands/plugins/delete.d.ts +14 -0
- package/dist/commands/plugins/delete.js +34 -0
- package/dist/commands/plugins/fields.d.ts +6 -0
- package/dist/commands/plugins/fields.js +17 -0
- package/dist/commands/plugins/list.d.ts +17 -0
- package/dist/commands/plugins/list.js +40 -0
- package/dist/commands/plugins/overview.d.ts +6 -0
- package/dist/commands/plugins/overview.js +17 -0
- package/dist/commands/store/list.d.ts +23 -0
- package/dist/commands/store/list.js +48 -0
- package/dist/commands/tags/fields.d.ts +6 -0
- package/dist/commands/tags/fields.js +13 -0
- package/dist/commands/tags/list.d.ts +16 -0
- package/dist/commands/tags/list.js +26 -0
- package/dist/commands/workflows/fields.d.ts +6 -0
- package/dist/commands/workflows/fields.js +13 -0
- package/dist/commands/workflows/list.d.ts +16 -0
- package/dist/commands/workflows/list.js +26 -0
- package/dist/config/colorConfig.d.ts +56 -0
- package/dist/config/colorConfig.js +161 -0
- package/dist/connect/connectHandler.d.ts +15 -0
- package/dist/connect/connectHandler.js +48 -0
- package/dist/context/contextCommand.d.ts +13 -0
- package/dist/context/contextCommand.js +193 -0
- package/dist/controllers/baseController.d.ts +43 -0
- package/dist/controllers/baseController.js +67 -0
- package/dist/controllers/feedController.d.ts +35 -0
- package/dist/controllers/feedController.js +53 -0
- package/dist/controllers/fileController.d.ts +56 -0
- package/dist/controllers/fileController.js +93 -0
- package/dist/controllers/pluginContextController.d.ts +24 -0
- package/dist/controllers/pluginContextController.js +49 -0
- package/dist/controllers/pluginController.d.ts +70 -0
- package/dist/controllers/pluginController.js +98 -0
- package/dist/controllers/pluginMetaController.d.ts +41 -0
- package/dist/controllers/pluginMetaController.js +52 -0
- package/dist/feeds/feedHandler.d.ts +64 -0
- package/dist/feeds/feedHandler.js +203 -0
- package/dist/filesystem/fileGroupHandler.d.ts +92 -0
- package/dist/filesystem/fileGroupHandler.js +318 -0
- package/dist/filesystem/filesystemHandler.d.ts +12 -0
- package/dist/filesystem/filesystemHandler.js +135 -0
- package/dist/filesystem/inodeCommand.d.ts +12 -0
- package/dist/filesystem/inodeCommand.js +37 -0
- package/dist/handlers/baseGroupHandler.d.ts +103 -0
- package/dist/handlers/baseGroupHandler.js +342 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +239 -0
- package/dist/lfs/lfs.d.ts +25 -0
- package/dist/lfs/lfs.js +74 -0
- package/dist/man/man.d.ts +15 -0
- package/dist/man/man.js +31 -0
- package/dist/man/renderer.d.ts +26 -0
- package/dist/man/renderer.js +187 -0
- package/dist/models/feed.d.ts +18 -0
- package/dist/models/feed.js +8 -0
- package/dist/models/listing.d.ts +33 -0
- package/dist/models/listing.js +9 -0
- package/dist/models/plugin.d.ts +27 -0
- package/dist/models/plugin.js +1 -0
- package/dist/models/resource.d.ts +39 -0
- package/dist/models/resource.js +9 -0
- package/dist/pacs/pacsQueryHandler.d.ts +55 -0
- package/dist/pacs/pacsQueryHandler.js +196 -0
- package/dist/pacs/pacsQueryPayload.d.ts +19 -0
- package/dist/pacs/pacsQueryPayload.js +44 -0
- package/dist/pacs/pacsResultRender.d.ts +20 -0
- package/dist/pacs/pacsResultRender.js +141 -0
- package/dist/pacs/pacsRetrieveHandler.d.ts +87 -0
- package/dist/pacs/pacsRetrieveHandler.js +272 -0
- package/dist/pacs/pacsServerHandler.d.ts +15 -0
- package/dist/pacs/pacsServerHandler.js +32 -0
- package/dist/path/pathCommand.d.ts +64 -0
- package/dist/path/pathCommand.js +805 -0
- package/dist/path/pathMapper.d.ts +189 -0
- package/dist/path/pathMapper.js +382 -0
- package/dist/plugins/pluginGroupHandler.d.ts +42 -0
- package/dist/plugins/pluginGroupHandler.js +90 -0
- package/dist/plugins/pluginHandler.d.ts +87 -0
- package/dist/plugins/pluginHandler.js +303 -0
- package/dist/plugins/pluginMetaHandler.d.ts +21 -0
- package/dist/plugins/pluginMetaHandler.js +27 -0
- package/dist/screen/screen.d.ts +214 -0
- package/dist/screen/screen.js +478 -0
- package/dist/utils/admin_prompt.d.ts +42 -0
- package/dist/utils/admin_prompt.js +105 -0
- package/dist/utils/cli.d.ts +67 -0
- package/dist/utils/cli.js +112 -0
- package/dist/utils/docker.d.ts +74 -0
- package/dist/utils/docker.js +155 -0
- package/dist/utils/input_format.d.ts +77 -0
- package/dist/utils/input_format.js +135 -0
- package/dist/utils/sort.d.ts +29 -0
- package/dist/utils/sort.js +63 -0
- package/dist/utils/ui.d.ts +7 -0
- package/dist/utils/ui.js +26 -0
- package/dist/utils.d.ts +15 -0
- package/dist/utils.js +14 -0
- package/dist/views/compute.d.ts +17 -0
- package/dist/views/compute.js +40 -0
- package/dist/views/connect.d.ts +13 -0
- package/dist/views/connect.js +35 -0
- package/dist/views/feed.d.ts +44 -0
- package/dist/views/feed.js +110 -0
- package/dist/views/file.d.ts +25 -0
- package/dist/views/file.js +71 -0
- package/dist/views/fs.d.ts +51 -0
- package/dist/views/fs.js +105 -0
- package/dist/views/ls.d.ts +37 -0
- package/dist/views/ls.js +190 -0
- package/dist/views/plugin.d.ts +28 -0
- package/dist/views/plugin.js +71 -0
- package/dist/views/pluginParameters.d.ts +17 -0
- package/dist/views/pluginParameters.js +79 -0
- package/docs/00_intro.adoc +25 -0
- package/docs/01_setup.adoc +63 -0
- package/docs/02_context.adoc +128 -0
- package/docs/03_searchable.adoc +134 -0
- package/docs/10_everyday_examples.adoc +9 -0
- package/docs/11_upload_data.adoc +146 -0
- package/docs/12_create_a_feed.adoc +9 -0
- package/docs/13_run_a_plugin.adoc +271 -0
- package/docs/20_plugins.adoc +16 -0
- package/docs/21_pluginReadme.adoc +123 -0
- package/docs/30_filesystem.adoc +93 -0
- package/docs/31_fileops.adoc +51 -0
- package/docs/32_file_content.adoc +471 -0
- package/docs/_architecture.adoc +48 -0
- package/docs/_deepContext.adoc +84 -0
- package/docs/_roadmap.adoc +42 -0
- package/docs/_searchable.adoc +187 -0
- package/docs/_state.adoc +68 -0
- package/docs/pacs.adoc +101 -0
- package/docs/pathMapper.md +246 -0
- package/package.json +92 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for feed business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISFeedGroup, SimpleRecord } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
import { CLIoptions } from "../utils/cli.js";
|
|
9
|
+
/**
|
|
10
|
+
* Controller for managing ChRIS feeds.
|
|
11
|
+
* Handles feed creation, sharing, and other feed-specific operations.
|
|
12
|
+
*/
|
|
13
|
+
export declare class FeedController extends BaseController {
|
|
14
|
+
constructor(chrisObject: ChRISFeedGroup);
|
|
15
|
+
/**
|
|
16
|
+
* Factory method to create a new FeedController.
|
|
17
|
+
*
|
|
18
|
+
* @returns A new FeedController instance.
|
|
19
|
+
*/
|
|
20
|
+
static controller_create(): FeedController;
|
|
21
|
+
/**
|
|
22
|
+
* Shares feeds based on CLI options.
|
|
23
|
+
*
|
|
24
|
+
* @param options - CLI options for sharing.
|
|
25
|
+
* @returns A Promise resolving to void.
|
|
26
|
+
*/
|
|
27
|
+
feeds_share(options: CLIoptions): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new feed from directories.
|
|
30
|
+
*
|
|
31
|
+
* @param options - CLI options containing 'dirs' and other feed params.
|
|
32
|
+
* @returns A Promise resolving to the created feed's SimpleRecord or null.
|
|
33
|
+
*/
|
|
34
|
+
feed_create(options: CLIoptions): Promise<SimpleRecord | null>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for feed business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISFeedGroup, ChRISFeed, listParams_fromOptions } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
/**
|
|
9
|
+
* Controller for managing ChRIS feeds.
|
|
10
|
+
* Handles feed creation, sharing, and other feed-specific operations.
|
|
11
|
+
*/
|
|
12
|
+
export class FeedController extends BaseController {
|
|
13
|
+
constructor(chrisObject) {
|
|
14
|
+
super(chrisObject);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Factory method to create a new FeedController.
|
|
18
|
+
*
|
|
19
|
+
* @returns A new FeedController instance.
|
|
20
|
+
*/
|
|
21
|
+
static controller_create() {
|
|
22
|
+
const chrisFeedGroup = new ChRISFeedGroup();
|
|
23
|
+
return new FeedController(chrisFeedGroup);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Shares feeds based on CLI options.
|
|
27
|
+
*
|
|
28
|
+
* @param options - CLI options for sharing.
|
|
29
|
+
* @returns A Promise resolving to void.
|
|
30
|
+
*/
|
|
31
|
+
async feeds_share(options) {
|
|
32
|
+
// Placeholder logic
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new feed from directories.
|
|
37
|
+
*
|
|
38
|
+
* @param options - CLI options containing 'dirs' and other feed params.
|
|
39
|
+
* @returns A Promise resolving to the created feed's SimpleRecord or null.
|
|
40
|
+
*/
|
|
41
|
+
async feed_create(options) {
|
|
42
|
+
const chrisFeed = new ChRISFeed();
|
|
43
|
+
try {
|
|
44
|
+
const dirs = options.dirs;
|
|
45
|
+
const feedParams = listParams_fromOptions({ ...options, returnFilter: "params" });
|
|
46
|
+
return await chrisFeed.createFromDirs(dirs, feedParams);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
// Logging handled by cumin errorStack or caller
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for file business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISEmbeddedResourceGroup, ChrisPathNode } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
import { CLIoptions } from "../utils/cli.js";
|
|
9
|
+
/**
|
|
10
|
+
* Controller for managing ChRIS file system resources (files, links, directories).
|
|
11
|
+
* Extends BaseController to provide file-specific functionality.
|
|
12
|
+
* This class now acts as a CLI-specific adapter for the core file logic in Salsa.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FileController extends BaseController {
|
|
15
|
+
private _path;
|
|
16
|
+
private _assetName;
|
|
17
|
+
constructor(chrisObject: ChRISEmbeddedResourceGroup<ChrisPathNode>, path: string, assetName: string);
|
|
18
|
+
/**
|
|
19
|
+
* Factory method to create a FileController for a specific asset type.
|
|
20
|
+
* Now leverages `salsa`'s `files_getGroup`.
|
|
21
|
+
*
|
|
22
|
+
* @param assetName - The type of asset ('files', 'links', 'dirs').
|
|
23
|
+
* @param path - Optional path. Defaults to current context.
|
|
24
|
+
* @returns A Promise resolving to a new FileController instance, or null on error.
|
|
25
|
+
* @throws Error if asset type is unsupported or context creation fails.
|
|
26
|
+
*/
|
|
27
|
+
static handler_create(assetName: string, path?: string): Promise<FileController | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Factory method to create a FileController for a single file.
|
|
30
|
+
* Now leverages `salsa`'s `files_getSingle`.
|
|
31
|
+
*
|
|
32
|
+
* @param path - The path to the file.
|
|
33
|
+
* @returns A Promise resolving to a new FileController, or null on error.
|
|
34
|
+
* @throws Error if context creation fails.
|
|
35
|
+
*/
|
|
36
|
+
static member_create(path: string): Promise<FileController | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Shares files using `salsa`'s logic.
|
|
39
|
+
*
|
|
40
|
+
* @param options - CLI options for sharing. Expected to contain `fileId` and other sharing parameters.
|
|
41
|
+
* @returns A Promise resolving to void.
|
|
42
|
+
*/
|
|
43
|
+
files_share(options: CLIoptions): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Views content of a file using `salsa`'s logic.
|
|
46
|
+
*
|
|
47
|
+
* @param options - CLI options for viewing. Expected to contain `fileId` and other viewing parameters.
|
|
48
|
+
* @returns A Promise resolving to void (output is handled by salsa or logged).
|
|
49
|
+
*/
|
|
50
|
+
file_view(filePath: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the current path associated with this controller.
|
|
53
|
+
* @returns The path string.
|
|
54
|
+
*/
|
|
55
|
+
get path_get(): string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for file business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { errorStack } from "@fnndsc/cumin";
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { BaseController } from "./baseController.js";
|
|
9
|
+
import { files_getGroup, files_getSingle, files_share as salsaFiles_share, fileContent_get } from "@fnndsc/salsa";
|
|
10
|
+
/**
|
|
11
|
+
* Controller for managing ChRIS file system resources (files, links, directories).
|
|
12
|
+
* Extends BaseController to provide file-specific functionality.
|
|
13
|
+
* This class now acts as a CLI-specific adapter for the core file logic in Salsa.
|
|
14
|
+
*/
|
|
15
|
+
export class FileController extends BaseController {
|
|
16
|
+
constructor(chrisObject, path, assetName) {
|
|
17
|
+
super(chrisObject);
|
|
18
|
+
this._path = path;
|
|
19
|
+
this._assetName = assetName;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Factory method to create a FileController for a specific asset type.
|
|
23
|
+
* Now leverages `salsa`'s `files_getGroup`.
|
|
24
|
+
*
|
|
25
|
+
* @param assetName - The type of asset ('files', 'links', 'dirs').
|
|
26
|
+
* @param path - Optional path. Defaults to current context.
|
|
27
|
+
* @returns A Promise resolving to a new FileController instance, or null on error.
|
|
28
|
+
* @throws Error if asset type is unsupported or context creation fails.
|
|
29
|
+
*/
|
|
30
|
+
static async handler_create(assetName, path) {
|
|
31
|
+
const chrisFileSystemGroup = await files_getGroup(assetName, path);
|
|
32
|
+
if (!chrisFileSystemGroup) {
|
|
33
|
+
// Error handling is done in salsa, so we just pass null here
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const groupWithFolder = chrisFileSystemGroup;
|
|
37
|
+
const effectivePath = path || groupWithFolder.folder || "";
|
|
38
|
+
return new FileController(chrisFileSystemGroup, effectivePath, assetName);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Factory method to create a FileController for a single file.
|
|
42
|
+
* Now leverages `salsa`'s `files_getSingle`.
|
|
43
|
+
*
|
|
44
|
+
* @param path - The path to the file.
|
|
45
|
+
* @returns A Promise resolving to a new FileController, or null on error.
|
|
46
|
+
* @throws Error if context creation fails.
|
|
47
|
+
*/
|
|
48
|
+
static async member_create(path) {
|
|
49
|
+
const chrisFilesGroup = await files_getSingle(path);
|
|
50
|
+
if (!chrisFilesGroup) {
|
|
51
|
+
// Error handling is done in salsa, so we just pass null here
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return new FileController(chrisFilesGroup, path, "file");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Shares files using `salsa`'s logic.
|
|
58
|
+
*
|
|
59
|
+
* @param options - CLI options for sharing. Expected to contain `fileId` and other sharing parameters.
|
|
60
|
+
* @returns A Promise resolving to void.
|
|
61
|
+
*/
|
|
62
|
+
async files_share(options) {
|
|
63
|
+
const fileId = options.fileId; // Assuming CLIoptions has a fileId property
|
|
64
|
+
if (fileId === undefined) {
|
|
65
|
+
console.error("Error: fileId is required for sharing.");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const shareOptions = { ...options }; // Pass all CLI options as share options for now
|
|
69
|
+
await salsaFiles_share(fileId, shareOptions);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Views content of a file using `salsa`'s logic.
|
|
73
|
+
*
|
|
74
|
+
* @param options - CLI options for viewing. Expected to contain `fileId` and other viewing parameters.
|
|
75
|
+
* @returns A Promise resolving to void (output is handled by salsa or logged).
|
|
76
|
+
*/
|
|
77
|
+
async file_view(filePath) {
|
|
78
|
+
const result = await fileContent_get(filePath);
|
|
79
|
+
if (!result.ok) {
|
|
80
|
+
const error = errorStack.stack_pop();
|
|
81
|
+
console.error(chalk.red(`Error viewing file: ${error?.message || 'Unknown error'}`));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.log(result.value);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Gets the current path associated with this controller.
|
|
88
|
+
* @returns The path string.
|
|
89
|
+
*/
|
|
90
|
+
get path_get() {
|
|
91
|
+
return this._path;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for plugin-context business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISEmbeddedResourceGroup, ChrisPluginSummary } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
/**
|
|
9
|
+
* Controller for managing plugin context resources (computes, instances, parameters).
|
|
10
|
+
*/
|
|
11
|
+
export declare class PluginContextController extends BaseController {
|
|
12
|
+
private _id;
|
|
13
|
+
private _assetName;
|
|
14
|
+
constructor(chrisObject: ChRISEmbeddedResourceGroup<ChrisPluginSummary>, id: number | null, assetName: string);
|
|
15
|
+
/**
|
|
16
|
+
* Factory method to create a new PluginContextController instance.
|
|
17
|
+
*
|
|
18
|
+
* @param assetName - The type of plugin context to handle ('computesofplugin', 'instancesofplugin', 'parametersofplugin').
|
|
19
|
+
* @param id - Optional plugin ID. Defaults to current ChRIS plugin context.
|
|
20
|
+
* @returns A Promise resolving to a new PluginContextController instance.
|
|
21
|
+
* @throws Error if an unsupported asset type is provided or initialization fails.
|
|
22
|
+
*/
|
|
23
|
+
static controller_create(assetName: string, id?: number | null): Promise<PluginContextController>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for plugin-context business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { objContext_create, chrisContext, Context, } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
/**
|
|
9
|
+
* Controller for managing plugin context resources (computes, instances, parameters).
|
|
10
|
+
*/
|
|
11
|
+
export class PluginContextController extends BaseController {
|
|
12
|
+
constructor(chrisObject, id, assetName) {
|
|
13
|
+
super(chrisObject);
|
|
14
|
+
this._id = id;
|
|
15
|
+
this._assetName = assetName;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Factory method to create a new PluginContextController instance.
|
|
19
|
+
*
|
|
20
|
+
* @param assetName - The type of plugin context to handle ('computesofplugin', 'instancesofplugin', 'parametersofplugin').
|
|
21
|
+
* @param id - Optional plugin ID. Defaults to current ChRIS plugin context.
|
|
22
|
+
* @returns A Promise resolving to a new PluginContextController instance.
|
|
23
|
+
* @throws Error if an unsupported asset type is provided or initialization fails.
|
|
24
|
+
*/
|
|
25
|
+
static async controller_create(assetName, id) {
|
|
26
|
+
if (!id) {
|
|
27
|
+
const pluginContext = await chrisContext.current_get(Context.ChRISplugin);
|
|
28
|
+
id = pluginContext ? Number(pluginContext) : 1;
|
|
29
|
+
}
|
|
30
|
+
let chrisPluginSystemGroup = null;
|
|
31
|
+
switch (assetName) {
|
|
32
|
+
case "computesofplugin":
|
|
33
|
+
chrisPluginSystemGroup = (await objContext_create("ComputesOfPlugin", `plugin:${id}`));
|
|
34
|
+
break;
|
|
35
|
+
case "instancesofplugin":
|
|
36
|
+
chrisPluginSystemGroup = (await objContext_create("InstancesOfPlugin", `plugin:${id}`));
|
|
37
|
+
break;
|
|
38
|
+
case "parametersofplugin":
|
|
39
|
+
chrisPluginSystemGroup = (await objContext_create("ParametersOfPlugin", `plugin:${id}`));
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
throw new Error(`Unsupported asset type: ${assetName}`);
|
|
43
|
+
}
|
|
44
|
+
if (!chrisPluginSystemGroup) {
|
|
45
|
+
throw new Error(`Failed to initialize plugin context group for ${assetName}`);
|
|
46
|
+
}
|
|
47
|
+
return new PluginContextController(chrisPluginSystemGroup, id, assetName);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for plugin business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISPluginGroup, Dictionary } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
import { CLIoptions } from "../utils/cli.js";
|
|
9
|
+
/**
|
|
10
|
+
* Controller for managing ChRIS plugins.
|
|
11
|
+
* Handles plugin searching, running, and group operations.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PluginController extends BaseController {
|
|
14
|
+
constructor(chrisObject: ChRISPluginGroup);
|
|
15
|
+
/**
|
|
16
|
+
* Factory method to create a new PluginController.
|
|
17
|
+
*
|
|
18
|
+
* @returns A new PluginController instance.
|
|
19
|
+
*/
|
|
20
|
+
static controller_create(): PluginController;
|
|
21
|
+
/**
|
|
22
|
+
* Provides an overview of plugin-group operations (placeholder).
|
|
23
|
+
*
|
|
24
|
+
* @returns A Promise resolving to void.
|
|
25
|
+
*/
|
|
26
|
+
plugins_overview(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Fetches detailed information for a specific plugin (placeholder).
|
|
29
|
+
*
|
|
30
|
+
* @param pluginId - The ID of the plugin.
|
|
31
|
+
* @returns A Promise resolving to void (logging happens in handler for now, or should move here?).
|
|
32
|
+
*/
|
|
33
|
+
plugin_infoGet(pluginId: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Runs a plugin instance.
|
|
36
|
+
*
|
|
37
|
+
* @param searchable - The plugin search string.
|
|
38
|
+
* @param params - The plugin parameters.
|
|
39
|
+
* @returns A Promise resolving to the created instance dictionary or null.
|
|
40
|
+
*/
|
|
41
|
+
plugin_run(searchable: string, params: string): Promise<Dictionary | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Resolves a searchable plugin string to a list of IDs.
|
|
44
|
+
*
|
|
45
|
+
* @param searchable - The search string.
|
|
46
|
+
* @returns A Promise resolving to an array of IDs or null.
|
|
47
|
+
*/
|
|
48
|
+
plugin_searchableToIDs(searchable: string): Promise<string[] | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves the raw README content from a repository URL.
|
|
51
|
+
*
|
|
52
|
+
* @param repoUrl - The base URL of the plugin repository.
|
|
53
|
+
* @returns A Promise resolving to the README content string or null if not found.
|
|
54
|
+
*/
|
|
55
|
+
readmeContent_fetch(repoUrl: string): Promise<string | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves the documentation URL for a specific plugin ID.
|
|
58
|
+
*
|
|
59
|
+
* @param pluginId - The ID of the plugin.
|
|
60
|
+
* @returns A Promise resolving to the documentation URL or null.
|
|
61
|
+
*/
|
|
62
|
+
documentationUrl_get(pluginId: string): Promise<string | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves a plugin ID based on search options.
|
|
65
|
+
*
|
|
66
|
+
* @param options - CLI options for searching for a plugin.
|
|
67
|
+
* @returns A Promise resolving to the plugin ID as a string, or null if not found/ambiguous.
|
|
68
|
+
*/
|
|
69
|
+
pluginID_fromSearch(options: CLIoptions): Promise<string | null>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller for plugin business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISPluginGroup, dictionary_fromCLI } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
import { plugin_run as salsaPlugin_run, plugins_searchableToIDs as salsaPlugins_searchableToIDs, pluginMeta_readmeContentFetch, pluginMeta_documentationUrlGet, pluginMeta_pluginIDFromSearch } from "@fnndsc/salsa";
|
|
9
|
+
/**
|
|
10
|
+
* Controller for managing ChRIS plugins.
|
|
11
|
+
* Handles plugin searching, running, and group operations.
|
|
12
|
+
*/
|
|
13
|
+
export class PluginController extends BaseController {
|
|
14
|
+
constructor(chrisObject) {
|
|
15
|
+
super(chrisObject);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Factory method to create a new PluginController.
|
|
19
|
+
*
|
|
20
|
+
* @returns A new PluginController instance.
|
|
21
|
+
*/
|
|
22
|
+
static controller_create() {
|
|
23
|
+
const chrisPluginGroup = new ChRISPluginGroup();
|
|
24
|
+
return new PluginController(chrisPluginGroup);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Provides an overview of plugin-group operations (placeholder).
|
|
28
|
+
*
|
|
29
|
+
* @returns A Promise resolving to void.
|
|
30
|
+
*/
|
|
31
|
+
async plugins_overview() {
|
|
32
|
+
return Promise.resolve();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetches detailed information for a specific plugin (placeholder).
|
|
36
|
+
*
|
|
37
|
+
* @param pluginId - The ID of the plugin.
|
|
38
|
+
* @returns A Promise resolving to void (logging happens in handler for now, or should move here?).
|
|
39
|
+
*/
|
|
40
|
+
async plugin_infoGet(pluginId) {
|
|
41
|
+
// Placeholder, logic was mainly logging in handler
|
|
42
|
+
return Promise.resolve();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Runs a plugin instance.
|
|
46
|
+
*
|
|
47
|
+
* @param searchable - The plugin search string.
|
|
48
|
+
* @param params - The plugin parameters.
|
|
49
|
+
* @returns A Promise resolving to the created instance dictionary or null.
|
|
50
|
+
*/
|
|
51
|
+
async plugin_run(searchable, params) {
|
|
52
|
+
let parsedParams = {};
|
|
53
|
+
try {
|
|
54
|
+
parsedParams = dictionary_fromCLI(params);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
console.error("Error parsing plugin parameters:", e);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return await salsaPlugin_run(searchable, parsedParams);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolves a searchable plugin string to a list of IDs.
|
|
64
|
+
*
|
|
65
|
+
* @param searchable - The search string.
|
|
66
|
+
* @returns A Promise resolving to an array of IDs or null.
|
|
67
|
+
*/
|
|
68
|
+
async plugin_searchableToIDs(searchable) {
|
|
69
|
+
return await salsaPlugins_searchableToIDs(searchable);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves the raw README content from a repository URL.
|
|
73
|
+
*
|
|
74
|
+
* @param repoUrl - The base URL of the plugin repository.
|
|
75
|
+
* @returns A Promise resolving to the README content string or null if not found.
|
|
76
|
+
*/
|
|
77
|
+
async readmeContent_fetch(repoUrl) {
|
|
78
|
+
return await pluginMeta_readmeContentFetch(repoUrl);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves the documentation URL for a specific plugin ID.
|
|
82
|
+
*
|
|
83
|
+
* @param pluginId - The ID of the plugin.
|
|
84
|
+
* @returns A Promise resolving to the documentation URL or null.
|
|
85
|
+
*/
|
|
86
|
+
async documentationUrl_get(pluginId) {
|
|
87
|
+
return await pluginMeta_documentationUrlGet(pluginId);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves a plugin ID based on search options.
|
|
91
|
+
*
|
|
92
|
+
* @param options - CLI options for searching for a plugin.
|
|
93
|
+
* @returns A Promise resolving to the plugin ID as a string, or null if not found/ambiguous.
|
|
94
|
+
*/
|
|
95
|
+
async pluginID_fromSearch(options) {
|
|
96
|
+
return await pluginMeta_pluginIDFromSearch(options);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller mediating plugin-meta business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISPluginMetaPluginGroup } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
import { CLIoptions } from "../utils/cli.js";
|
|
9
|
+
/**
|
|
10
|
+
* Controller for managing ChRIS plugin metadata.
|
|
11
|
+
*/
|
|
12
|
+
export declare class PluginMetaController extends BaseController {
|
|
13
|
+
constructor(chrisObject: ChRISPluginMetaPluginGroup);
|
|
14
|
+
/**
|
|
15
|
+
* Factory method to create a new PluginMetaController.
|
|
16
|
+
*
|
|
17
|
+
* @returns A new PluginMetaController instance.
|
|
18
|
+
*/
|
|
19
|
+
static controller_create(): PluginMetaController;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the raw README content from a repository URL.
|
|
22
|
+
*
|
|
23
|
+
* @param repoUrl - The base URL of the plugin repository.
|
|
24
|
+
* @returns A Promise resolving to the README content string or null if not found.
|
|
25
|
+
*/
|
|
26
|
+
readmeContent_fetch(repoUrl: string): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves the documentation URL for a specific plugin ID.
|
|
29
|
+
*
|
|
30
|
+
* @param pluginId - The ID of the plugin.
|
|
31
|
+
* @returns A Promise resolving to the documentation URL or null.
|
|
32
|
+
*/
|
|
33
|
+
documentationUrl_get(pluginId: string): Promise<string | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves a plugin ID based on search options.
|
|
36
|
+
*
|
|
37
|
+
* @param options - CLI options for searching for a plugin.
|
|
38
|
+
* @returns A Promise resolving to the plugin ID as a string, or null if not found/ambiguous.
|
|
39
|
+
*/
|
|
40
|
+
pluginID_fromSearch(options: CLIoptions): Promise<string | null>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Controller mediating plugin-meta business logic and presentation.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISPluginMetaPluginGroup, } from "@fnndsc/cumin";
|
|
7
|
+
import { BaseController } from "./baseController.js";
|
|
8
|
+
import { pluginMeta_readmeContentFetch, pluginMeta_documentationUrlGet, pluginMeta_pluginIDFromSearch } from "@fnndsc/salsa";
|
|
9
|
+
/**
|
|
10
|
+
* Controller for managing ChRIS plugin metadata.
|
|
11
|
+
*/
|
|
12
|
+
export class PluginMetaController extends BaseController {
|
|
13
|
+
constructor(chrisObject) {
|
|
14
|
+
super(chrisObject);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Factory method to create a new PluginMetaController.
|
|
18
|
+
*
|
|
19
|
+
* @returns A new PluginMetaController instance.
|
|
20
|
+
*/
|
|
21
|
+
static controller_create() {
|
|
22
|
+
const chrisPluginMetaGroup = new ChRISPluginMetaPluginGroup();
|
|
23
|
+
return new PluginMetaController(chrisPluginMetaGroup);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves the raw README content from a repository URL.
|
|
27
|
+
*
|
|
28
|
+
* @param repoUrl - The base URL of the plugin repository.
|
|
29
|
+
* @returns A Promise resolving to the README content string or null if not found.
|
|
30
|
+
*/
|
|
31
|
+
async readmeContent_fetch(repoUrl) {
|
|
32
|
+
return await pluginMeta_readmeContentFetch(repoUrl);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves the documentation URL for a specific plugin ID.
|
|
36
|
+
*
|
|
37
|
+
* @param pluginId - The ID of the plugin.
|
|
38
|
+
* @returns A Promise resolving to the documentation URL or null.
|
|
39
|
+
*/
|
|
40
|
+
async documentationUrl_get(pluginId) {
|
|
41
|
+
return await pluginMeta_documentationUrlGet(pluginId);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves a plugin ID based on search options.
|
|
45
|
+
*
|
|
46
|
+
* @param options - CLI options for searching for a plugin.
|
|
47
|
+
* @returns A Promise resolving to the plugin ID as a string, or null if not found/ambiguous.
|
|
48
|
+
*/
|
|
49
|
+
async pluginID_fromSearch(options) {
|
|
50
|
+
return await pluginMeta_pluginIDFromSearch(options);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Manages command groups and member operations for ChRIS feeds.
|
|
3
|
+
*
|
|
4
|
+
* This module defines the `FeedGroupHandler` and `FeedMemberHandler` classes,
|
|
5
|
+
* which orchestrate CLI commands for lists of feeds and individual feed operations.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from "commander";
|
|
10
|
+
import { CLIoptions } from "../utils/cli.js";
|
|
11
|
+
import { Feed } from "../models/feed.js";
|
|
12
|
+
/**
|
|
13
|
+
* Handles commands related to groups of ChRIS feeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare class FeedGroupHandler {
|
|
16
|
+
private baseGroupHandler;
|
|
17
|
+
private controller;
|
|
18
|
+
assetName: string;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Lists feed fields using the new command logic.
|
|
22
|
+
*/
|
|
23
|
+
feeds_fields(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Shares feeds matching a search term.
|
|
26
|
+
*
|
|
27
|
+
* @param searchable - The search term to find feeds.
|
|
28
|
+
* @param options - Sharing options (e.g. is_public).
|
|
29
|
+
*/
|
|
30
|
+
feeds_share(searchable: string, options: CLIoptions): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Deletes feeds using the new command logic.
|
|
33
|
+
* @param searchable - A string resolving to feed IDs.
|
|
34
|
+
* @param options - CLI options, including --force.
|
|
35
|
+
*/
|
|
36
|
+
feeds_delete(searchable: string, options: CLIoptions): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Sets up the Commander.js commands for feed group operations.
|
|
39
|
+
*
|
|
40
|
+
* @param program - The Commander.js program instance.
|
|
41
|
+
*/
|
|
42
|
+
feedGroupCommand_setup(program: Command): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Handles commands related to individual ChRIS feeds.
|
|
46
|
+
*/
|
|
47
|
+
export declare class FeedMemberHandler {
|
|
48
|
+
private assetName;
|
|
49
|
+
private controller;
|
|
50
|
+
constructor();
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new ChRIS feed based on CLI options.
|
|
53
|
+
*
|
|
54
|
+
* @param options - CLI options for feed creation.
|
|
55
|
+
* @returns A Promise resolving to the created Feed object, or null on failure.
|
|
56
|
+
*/
|
|
57
|
+
feed_create(options: CLIoptions): Promise<Feed | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Sets up the Commander.js commands for individual feed operations.
|
|
60
|
+
*
|
|
61
|
+
* @param program - The Commander.js program instance.
|
|
62
|
+
*/
|
|
63
|
+
feedCommand_setup(program: Command): void;
|
|
64
|
+
}
|