@fnndsc/cumin 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 +78 -0
- package/dist/activities/chrisActivity.d.ts +19 -0
- package/dist/activities/chrisActivity.js +29 -0
- package/dist/activities/chrisActivity.js.map +1 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.js +15 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/listCache.d.ts +182 -0
- package/dist/cache/listCache.js +266 -0
- package/dist/cache/listCache.js.map +1 -0
- package/dist/cache/procCache.d.ts +150 -0
- package/dist/cache/procCache.js +257 -0
- package/dist/cache/procCache.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +43 -0
- package/dist/cli.js.map +1 -0
- package/dist/compute/computeResources.d.ts +65 -0
- package/dist/compute/computeResources.js +113 -0
- package/dist/compute/computeResources.js.map +1 -0
- package/dist/config/config.d.ts +221 -0
- package/dist/config/config.js +350 -0
- package/dist/config/config.js.map +1 -0
- package/dist/connect/chrisConnection.d.ts +121 -0
- package/dist/connect/chrisConnection.js +303 -0
- package/dist/connect/chrisConnection.js.map +1 -0
- package/dist/context/chrisContext.d.ts +110 -0
- package/dist/context/chrisContext.js +324 -0
- package/dist/context/chrisContext.js.map +1 -0
- package/dist/error/errorStack.d.ts +115 -0
- package/dist/error/errorStack.js +175 -0
- package/dist/error/errorStack.js.map +1 -0
- package/dist/feeds/chrisFeed.d.ts +188 -0
- package/dist/feeds/chrisFeed.js +432 -0
- package/dist/feeds/chrisFeed.js.map +1 -0
- package/dist/filebrowser/chrisFileBrowser.d.ts +77 -0
- package/dist/filebrowser/chrisFileBrowser.js +134 -0
- package/dist/filebrowser/chrisFileBrowser.js.map +1 -0
- package/dist/filebrowser/chrisFiles.d.ts +67 -0
- package/dist/filebrowser/chrisFiles.js +130 -0
- package/dist/filebrowser/chrisFiles.js.map +1 -0
- package/dist/filebrowser/chrisPACS.d.ts +43 -0
- package/dist/filebrowser/chrisPACS.js +103 -0
- package/dist/filebrowser/chrisPACS.js.map +1 -0
- package/dist/filebrowser/chrisPipeline.d.ts +47 -0
- package/dist/filebrowser/chrisPipeline.js +118 -0
- package/dist/filebrowser/chrisPipeline.js.map +1 -0
- package/dist/groups/chrisGroups.d.ts +11 -0
- package/dist/groups/chrisGroups.js +18 -0
- package/dist/groups/chrisGroups.js.map +1 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/io/browser_io.d.ts +97 -0
- package/dist/io/browser_io.js +149 -0
- package/dist/io/browser_io.js.map +1 -0
- package/dist/io/chrisIO.d.ts +110 -0
- package/dist/io/chrisIO.js +415 -0
- package/dist/io/chrisIO.js.map +1 -0
- package/dist/io/io.d.ts +21 -0
- package/dist/io/io.js +6 -0
- package/dist/io/io.js.map +1 -0
- package/dist/io/node_io.d.ts +30 -0
- package/dist/io/node_io.js +188 -0
- package/dist/io/node_io.js.map +1 -0
- package/dist/jobs/chrisJob.d.ts +43 -0
- package/dist/jobs/chrisJob.js +169 -0
- package/dist/jobs/chrisJob.js.map +1 -0
- package/dist/jobs/index.d.ts +7 -0
- package/dist/jobs/index.js +24 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobMonitor.d.ts +46 -0
- package/dist/jobs/jobMonitor.js +102 -0
- package/dist/jobs/jobMonitor.js.map +1 -0
- package/dist/pacs/chrisPACS.d.ts +200 -0
- package/dist/pacs/chrisPACS.js +562 -0
- package/dist/pacs/chrisPACS.js.map +1 -0
- package/dist/path/chrisPath.d.ts +78 -0
- package/dist/path/chrisPath.js +190 -0
- package/dist/path/chrisPath.js.map +1 -0
- package/dist/pipelines/chrisPipeline.d.ts +86 -0
- package/dist/pipelines/chrisPipeline.js +180 -0
- package/dist/pipelines/chrisPipeline.js.map +1 -0
- package/dist/pluginmetas/chrisPluginMetas.d.ts +11 -0
- package/dist/pluginmetas/chrisPluginMetas.js +18 -0
- package/dist/pluginmetas/chrisPluginMetas.js.map +1 -0
- package/dist/plugins/chrisPluginMetaPlugins.d.ts +12 -0
- package/dist/plugins/chrisPluginMetaPlugins.js +19 -0
- package/dist/plugins/chrisPluginMetaPlugins.js.map +1 -0
- package/dist/plugins/chrisPlugins.d.ts +127 -0
- package/dist/plugins/chrisPlugins.js +528 -0
- package/dist/plugins/chrisPlugins.js.map +1 -0
- package/dist/resources/chrisEmbeddedResourceGroup.d.ts +73 -0
- package/dist/resources/chrisEmbeddedResourceGroup.js +148 -0
- package/dist/resources/chrisEmbeddedResourceGroup.js.map +1 -0
- package/dist/resources/chrisObjContext.d.ts +16 -0
- package/dist/resources/chrisObjContext.js +109 -0
- package/dist/resources/chrisObjContext.js.map +1 -0
- package/dist/resources/chrisResourceGroup.d.ts +30 -0
- package/dist/resources/chrisResourceGroup.js +47 -0
- package/dist/resources/chrisResourceGroup.js.map +1 -0
- package/dist/resources/chrisResources.d.ts +163 -0
- package/dist/resources/chrisResources.js +415 -0
- package/dist/resources/chrisResources.js.map +1 -0
- package/dist/tags/chrisTags.d.ts +11 -0
- package/dist/tags/chrisTags.js +18 -0
- package/dist/tags/chrisTags.js.map +1 -0
- package/dist/users/chrisUsers.d.ts +34 -0
- package/dist/users/chrisUsers.js +57 -0
- package/dist/users/chrisUsers.js.map +1 -0
- package/dist/utils/keypair.d.ts +77 -0
- package/dist/utils/keypair.js +144 -0
- package/dist/utils/keypair.js.map +1 -0
- package/dist/utils/result.d.ts +77 -0
- package/dist/utils/result.js +58 -0
- package/dist/utils/result.js.map +1 -0
- package/dist/utils/searchable.d.ts +143 -0
- package/dist/utils/searchable.js +212 -0
- package/dist/utils/searchable.js.map +1 -0
- package/dist/workflows/chrisWorkflows.d.ts +11 -0
- package/dist/workflows/chrisWorkflows.js +18 -0
- package/dist/workflows/chrisWorkflows.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file ChRIS Path Analysis
|
|
4
|
+
*
|
|
5
|
+
* This module provides utilities for analyzing ChRIS filesystem paths.
|
|
6
|
+
* It determines execution context based on directory structure and extracts
|
|
7
|
+
* metadata from path components.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.path_isInFeed = path_isInFeed;
|
|
46
|
+
exports.path_extractPluginInstanceID = path_extractPluginInstanceID;
|
|
47
|
+
exports.path_extractFeedID = path_extractFeedID;
|
|
48
|
+
exports.path_findLatestDircopy = path_findLatestDircopy;
|
|
49
|
+
const path = __importStar(require("path"));
|
|
50
|
+
/**
|
|
51
|
+
* Determines if a path is within a ChRIS feed directory.
|
|
52
|
+
*
|
|
53
|
+
* Checks if the path contains the pattern: /feeds/feed_<numeric-id>/
|
|
54
|
+
*
|
|
55
|
+
* @param dirPath - The directory path to check.
|
|
56
|
+
* @returns True if the path is within a feed directory, false otherwise.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* path_isInFeed('/home/chris/feeds/feed_123/pl-dircopy_456/data/') // true
|
|
61
|
+
* path_isInFeed('/home/chris/uploads/data/') // false
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
function path_isInFeed(dirPath) {
|
|
65
|
+
// Pattern: /feeds/feed_<digits>/
|
|
66
|
+
const feedPattern = /\/feeds\/feed_\d+\//;
|
|
67
|
+
return feedPattern.test(dirPath);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Extracts the plugin instance ID from a path by finding the nearest
|
|
71
|
+
* ancestor directory matching the pattern: <plugin-name>_<instanceID>
|
|
72
|
+
*
|
|
73
|
+
* Walks up the directory tree from the given path until finding a directory
|
|
74
|
+
* that matches the plugin instance naming pattern.
|
|
75
|
+
*
|
|
76
|
+
* @param dirPath - The directory path to analyze.
|
|
77
|
+
* @returns The plugin instance ID as a number, or null if not found.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // From deep subdirectory
|
|
82
|
+
* path_extractPluginInstanceID('/home/chris/feeds/feed_123/pl-dircopy_456/data/sub/dir/')
|
|
83
|
+
* // Returns: 456
|
|
84
|
+
*
|
|
85
|
+
* // From data directory
|
|
86
|
+
* path_extractPluginInstanceID('/home/chris/feeds/feed_123/pl-dcm2niix_789/data/')
|
|
87
|
+
* // Returns: 789
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function path_extractPluginInstanceID(dirPath) {
|
|
91
|
+
// Pattern: <plugin-name>_<digits>
|
|
92
|
+
const instancePattern = /^(.+)_(\d+)$/;
|
|
93
|
+
// Walk up the directory tree
|
|
94
|
+
let currentPath = path.normalize(dirPath);
|
|
95
|
+
const root = path.parse(currentPath).root;
|
|
96
|
+
while (currentPath !== root) {
|
|
97
|
+
const dirname = path.basename(currentPath);
|
|
98
|
+
const match = dirname.match(instancePattern);
|
|
99
|
+
if (match) {
|
|
100
|
+
// Found a match: extract the instance ID
|
|
101
|
+
const instanceID = parseInt(match[2], 10);
|
|
102
|
+
return instanceID;
|
|
103
|
+
}
|
|
104
|
+
// Move up one directory
|
|
105
|
+
const parent = path.dirname(currentPath);
|
|
106
|
+
if (parent === currentPath) {
|
|
107
|
+
// Reached root without finding a match
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
currentPath = parent;
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Extracts the feed ID from a path.
|
|
116
|
+
*
|
|
117
|
+
* Looks for the pattern: /feeds/feed_<numeric-id>/ in the path.
|
|
118
|
+
*
|
|
119
|
+
* @param dirPath - The directory path to analyze.
|
|
120
|
+
* @returns The feed ID as a number, or null if not found.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* path_extractFeedID('/home/chris/feeds/feed_123/pl-dircopy_456/data/')
|
|
125
|
+
* // Returns: 123
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
function path_extractFeedID(dirPath) {
|
|
129
|
+
// Pattern: /feeds/feed_<digits>/
|
|
130
|
+
const feedPattern = /\/feeds\/feed_(\d+)\//;
|
|
131
|
+
const match = dirPath.match(feedPattern);
|
|
132
|
+
if (match) {
|
|
133
|
+
return parseInt(match[1], 10);
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Finds the highest version of pl-dircopy in a bin listing.
|
|
139
|
+
*
|
|
140
|
+
* If multiple pl-dircopy versions exist (e.g., pl-dircopy-v1.0.0, pl-dircopy-v2.1.0),
|
|
141
|
+
* returns the one with the highest version number.
|
|
142
|
+
*
|
|
143
|
+
* @param binListing - Array of plugin names from /bin directory.
|
|
144
|
+
* @returns The full name of the latest pl-dircopy plugin, or null if not found.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const plugins = ['pl-dircopy-v1.0.0', 'pl-dircopy-v2.1.0', 'pl-other-v1.0.0'];
|
|
149
|
+
* path_findLatestDircopy(plugins);
|
|
150
|
+
* // Returns: 'pl-dircopy-v2.1.0'
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
function path_findLatestDircopy(binListing) {
|
|
154
|
+
const dircopyPlugins = binListing.filter((name) => name.startsWith('pl-dircopy-v'));
|
|
155
|
+
if (dircopyPlugins.length === 0) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
if (dircopyPlugins.length === 1) {
|
|
159
|
+
return dircopyPlugins[0];
|
|
160
|
+
}
|
|
161
|
+
// Multiple versions - parse and find highest
|
|
162
|
+
// Pattern: pl-dircopy-vX.Y.Z
|
|
163
|
+
const versionPattern = /^pl-dircopy-v(\d+)\.(\d+)\.(\d+)$/;
|
|
164
|
+
const versioned = dircopyPlugins
|
|
165
|
+
.map((name) => {
|
|
166
|
+
const match = name.match(versionPattern);
|
|
167
|
+
if (!match)
|
|
168
|
+
return null;
|
|
169
|
+
return {
|
|
170
|
+
name,
|
|
171
|
+
major: parseInt(match[1], 10),
|
|
172
|
+
minor: parseInt(match[2], 10),
|
|
173
|
+
patch: parseInt(match[3], 10),
|
|
174
|
+
};
|
|
175
|
+
})
|
|
176
|
+
.filter((v) => v !== null);
|
|
177
|
+
if (versioned.length === 0) {
|
|
178
|
+
// Fallback: return first if version parsing failed
|
|
179
|
+
return dircopyPlugins[0];
|
|
180
|
+
}
|
|
181
|
+
versioned.sort((a, b) => {
|
|
182
|
+
if (a.major !== b.major)
|
|
183
|
+
return b.major - a.major;
|
|
184
|
+
if (a.minor !== b.minor)
|
|
185
|
+
return b.minor - a.minor;
|
|
186
|
+
return b.patch - a.patch;
|
|
187
|
+
});
|
|
188
|
+
return versioned[0].name;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=chrisPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrisPath.js","sourceRoot":"","sources":["../../src/path/chrisPath.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBH,sCAIC;AAuBD,oEA4BC;AAgBD,gDAUC;AAkBD,wDA+CC;AAlKD,2CAA6B;AAE7B;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa,CAAC,OAAe;IAC3C,iCAAiC;IACjC,MAAM,WAAW,GAAW,qBAAqB,CAAC;IAClD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,4BAA4B,CAAC,OAAe;IAC1D,kCAAkC;IAClC,MAAM,eAAe,GAAW,cAAc,CAAC;IAE/C,6BAA6B;IAC7B,IAAI,WAAW,GAAW,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;IAElD,OAAO,WAAW,KAAK,IAAI,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAW,IAAI,CAAC,Q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Pipeline and Workflow operations.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions to list registered pipelines, resolve them by name or ID,
|
|
5
|
+
* and create workflow instances (the runtime execution of a pipeline on a feed node).
|
|
6
|
+
*
|
|
7
|
+
* Terminology:
|
|
8
|
+
* Pipeline — the registered DAG template in CUBE
|
|
9
|
+
* Workflow — a pipeline instantiated on a specific plugin instance node
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { ChRISResourceGroup } from "../resources/chrisResourceGroup.js";
|
|
14
|
+
import { Result } from "../utils/result.js";
|
|
15
|
+
/**
|
|
16
|
+
* Group handler for ChRIS pipelines.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ChRISPipelineGroup extends ChRISResourceGroup {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Minimal shape of a pipeline record as returned by the ChRIS API.
|
|
23
|
+
*/
|
|
24
|
+
export interface PipelineRecord {
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
authors?: string;
|
|
29
|
+
category?: string;
|
|
30
|
+
locked?: boolean;
|
|
31
|
+
/** Filesystem-safe slug derived from the pipeline source filename (e.g. "Varus_valgus_full_4crg2N7"). */
|
|
32
|
+
slug?: string;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Per-node override for a workflow execution.
|
|
37
|
+
* All fields are optional — omitted fields use the pipeline's defaults.
|
|
38
|
+
*/
|
|
39
|
+
export interface WorkflowNodeOverride {
|
|
40
|
+
piping_id: number;
|
|
41
|
+
compute_resource_name?: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
plugin_parameter_defaults?: Array<{
|
|
44
|
+
name: string;
|
|
45
|
+
default: unknown;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Options for creating a workflow.
|
|
50
|
+
*/
|
|
51
|
+
export interface WorkflowCreateOptions {
|
|
52
|
+
/** Numeric ID of the previous plugin instance to attach the workflow root to. */
|
|
53
|
+
previousPluginInstId: number;
|
|
54
|
+
/** Per-node overrides. If omitted, all nodes run with pipeline defaults. */
|
|
55
|
+
nodeOverrides?: WorkflowNodeOverride[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Result of a successful workflow creation.
|
|
59
|
+
*/
|
|
60
|
+
export interface WorkflowResult {
|
|
61
|
+
workflowId: number;
|
|
62
|
+
/** Plugin instance IDs created by this workflow, in DAG order. */
|
|
63
|
+
pluginInstanceIds: number[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Lists all registered pipelines, optionally filtered by name substring.
|
|
67
|
+
*
|
|
68
|
+
* @param search - Optional name substring filter.
|
|
69
|
+
* @returns Result containing array of PipelineRecord on success.
|
|
70
|
+
*/
|
|
71
|
+
export declare function pipelines_list(search?: string): Promise<Result<PipelineRecord[]>>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolves a pipeline by name (exact match first, then substring) or numeric ID string.
|
|
74
|
+
*
|
|
75
|
+
* @param nameOrId - Pipeline name or numeric ID.
|
|
76
|
+
* @returns Result containing the matched PipelineRecord.
|
|
77
|
+
*/
|
|
78
|
+
export declare function pipeline_resolve(nameOrId: string): Promise<Result<PipelineRecord>>;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a workflow — instantiates a pipeline on a specific plugin instance node.
|
|
81
|
+
*
|
|
82
|
+
* @param pipelineId - Numeric ID of the registered pipeline.
|
|
83
|
+
* @param options - Execution options including the previous node and optional overrides.
|
|
84
|
+
* @returns Result containing workflow ID and created plugin instance IDs.
|
|
85
|
+
*/
|
|
86
|
+
export declare function pipeline_createWorkflow(pipelineId: number, options: WorkflowCreateOptions): Promise<Result<WorkflowResult>>;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file ChRIS Pipeline and Workflow operations.
|
|
4
|
+
*
|
|
5
|
+
* Provides functions to list registered pipelines, resolve them by name or ID,
|
|
6
|
+
* and create workflow instances (the runtime execution of a pipeline on a feed node).
|
|
7
|
+
*
|
|
8
|
+
* Terminology:
|
|
9
|
+
* Pipeline — the registered DAG template in CUBE
|
|
10
|
+
* Workflow — a pipeline instantiated on a specific plugin instance node
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ChRISPipelineGroup = void 0;
|
|
16
|
+
exports.pipelines_list = pipelines_list;
|
|
17
|
+
exports.pipeline_resolve = pipeline_resolve;
|
|
18
|
+
exports.pipeline_createWorkflow = pipeline_createWorkflow;
|
|
19
|
+
const chrisConnection_js_1 = require("../connect/chrisConnection.js");
|
|
20
|
+
const chrisResourceGroup_js_1 = require("../resources/chrisResourceGroup.js");
|
|
21
|
+
const errorStack_js_1 = require("../error/errorStack.js");
|
|
22
|
+
const result_js_1 = require("../utils/result.js");
|
|
23
|
+
/**
|
|
24
|
+
* Group handler for ChRIS pipelines.
|
|
25
|
+
*/
|
|
26
|
+
class ChRISPipelineGroup extends chrisResourceGroup_js_1.ChRISResourceGroup {
|
|
27
|
+
constructor() {
|
|
28
|
+
super('Pipelines', 'getPipelines');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.ChRISPipelineGroup = ChRISPipelineGroup;
|
|
32
|
+
/**
|
|
33
|
+
* Lists all registered pipelines, optionally filtered by name substring.
|
|
34
|
+
*
|
|
35
|
+
* @param search - Optional name substring filter.
|
|
36
|
+
* @returns Result containing array of PipelineRecord on success.
|
|
37
|
+
*/
|
|
38
|
+
async function pipelines_list(search) {
|
|
39
|
+
try {
|
|
40
|
+
const group = new ChRISPipelineGroup();
|
|
41
|
+
const params = search ? { name: search } : {};
|
|
42
|
+
const result = await group.asset.resources_getAll(params);
|
|
43
|
+
if (!result || !result.tableData)
|
|
44
|
+
return (0, result_js_1.Ok)([]);
|
|
45
|
+
return (0, result_js_1.Ok)(result.tableData);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
49
|
+
errorStack_js_1.errorStack.stack_push('error', `pipelines_list: ${msg}`);
|
|
50
|
+
return (0, result_js_1.Err)();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolves a pipeline by name (exact match first, then substring) or numeric ID string.
|
|
55
|
+
*
|
|
56
|
+
* @param nameOrId - Pipeline name or numeric ID.
|
|
57
|
+
* @returns Result containing the matched PipelineRecord.
|
|
58
|
+
*/
|
|
59
|
+
async function pipeline_resolve(nameOrId) {
|
|
60
|
+
const numericId = parseInt(nameOrId, 10);
|
|
61
|
+
if (!isNaN(numericId)) {
|
|
62
|
+
const client = await chrisConnection_js_1.chrisConnection.client_get();
|
|
63
|
+
if (!client) {
|
|
64
|
+
errorStack_js_1.errorStack.stack_push('error', 'Not connected to ChRIS');
|
|
65
|
+
return (0, result_js_1.Err)();
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const pipeline = await client.getPipeline(numericId);
|
|
69
|
+
if (!pipeline) {
|
|
70
|
+
errorStack_js_1.errorStack.stack_push('error', `Pipeline with ID ${numericId} not found`);
|
|
71
|
+
return (0, result_js_1.Err)();
|
|
72
|
+
}
|
|
73
|
+
const data = pipeline.data;
|
|
74
|
+
return (0, result_js_1.Ok)(data);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
78
|
+
errorStack_js_1.errorStack.stack_push('error', `pipeline_resolve: ${msg}`);
|
|
79
|
+
return (0, result_js_1.Err)();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const listResult = await pipelines_list(nameOrId);
|
|
83
|
+
if (!listResult.ok)
|
|
84
|
+
return (0, result_js_1.Err)();
|
|
85
|
+
const exact = listResult.value.find((p) => p.name === nameOrId);
|
|
86
|
+
if (exact)
|
|
87
|
+
return (0, result_js_1.Ok)(exact);
|
|
88
|
+
if (listResult.value.length === 1)
|
|
89
|
+
return (0, result_js_1.Ok)(listResult.value[0]);
|
|
90
|
+
if (listResult.value.length === 0) {
|
|
91
|
+
const fallbackClient = await chrisConnection_js_1.chrisConnection.client_get();
|
|
92
|
+
if (fallbackClient) {
|
|
93
|
+
// ID-suffix fallback: slug of form "{name}_id{N}" generated for pipelines without source files
|
|
94
|
+
const idSuffixMatch = nameOrId.match(/_id(\d+)$/);
|
|
95
|
+
if (idSuffixMatch) {
|
|
96
|
+
const directId = parseInt(idSuffixMatch[1], 10);
|
|
97
|
+
try {
|
|
98
|
+
const pipeline = await fallbackClient.getPipeline(directId);
|
|
99
|
+
if (pipeline) {
|
|
100
|
+
return (0, result_js_1.Ok)(pipeline.data);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (_e) { }
|
|
104
|
+
}
|
|
105
|
+
// Slug fallback: treat nameOrId as a source file fname fragment
|
|
106
|
+
try {
|
|
107
|
+
const sfList = await fallbackClient.getPipelineSourceFiles({ fname: nameOrId, limit: 1 });
|
|
108
|
+
const sfItems = sfList.getItems().filter((item) => {
|
|
109
|
+
const base = item.data.fname.split('/').pop() ?? '';
|
|
110
|
+
return base.replace(/\.(ya?ml)$/i, '') === nameOrId;
|
|
111
|
+
});
|
|
112
|
+
if (sfItems.length > 0 && sfItems[0].data.pipeline_name) {
|
|
113
|
+
const byName = await pipelines_list(sfItems[0].data.pipeline_name);
|
|
114
|
+
if (byName.ok) {
|
|
115
|
+
const exactByName = byName.value.find((p) => p.name === sfItems[0].data.pipeline_name);
|
|
116
|
+
if (exactByName)
|
|
117
|
+
return (0, result_js_1.Ok)(exactByName);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (_e) { }
|
|
122
|
+
}
|
|
123
|
+
errorStack_js_1.errorStack.stack_push('error', `No pipeline matching '${nameOrId}'`);
|
|
124
|
+
return (0, result_js_1.Err)();
|
|
125
|
+
}
|
|
126
|
+
errorStack_js_1.errorStack.stack_push('error', `Ambiguous: ${listResult.value.length} pipelines match '${nameOrId}'. Use ID or full name.`);
|
|
127
|
+
return (0, result_js_1.Err)();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates a workflow — instantiates a pipeline on a specific plugin instance node.
|
|
131
|
+
*
|
|
132
|
+
* @param pipelineId - Numeric ID of the registered pipeline.
|
|
133
|
+
* @param options - Execution options including the previous node and optional overrides.
|
|
134
|
+
* @returns Result containing workflow ID and created plugin instance IDs.
|
|
135
|
+
*/
|
|
136
|
+
async function pipeline_createWorkflow(pipelineId, options) {
|
|
137
|
+
const client = await chrisConnection_js_1.chrisConnection.client_get();
|
|
138
|
+
if (!client) {
|
|
139
|
+
errorStack_js_1.errorStack.stack_push('error', 'Not connected to ChRIS');
|
|
140
|
+
return (0, result_js_1.Err)();
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
let nodes_info;
|
|
144
|
+
if (options.nodeOverrides && options.nodeOverrides.length > 0) {
|
|
145
|
+
nodes_info = options.nodeOverrides;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const pipeline = await client.getPipeline(pipelineId);
|
|
149
|
+
if (!pipeline) {
|
|
150
|
+
errorStack_js_1.errorStack.stack_push('error', `Pipeline ${pipelineId} not found`);
|
|
151
|
+
return (0, result_js_1.Err)();
|
|
152
|
+
}
|
|
153
|
+
const pipelineWithPipings = pipeline;
|
|
154
|
+
const pipingsResponse = await pipelineWithPipings.getPluginPipings({ limit: 1000 });
|
|
155
|
+
const pipings = pipingsResponse.getItems();
|
|
156
|
+
nodes_info = pipings.map((p) => ({ piping_id: p.data.id }));
|
|
157
|
+
}
|
|
158
|
+
const clientWithWorkflow = client;
|
|
159
|
+
const workflow = await clientWithWorkflow.createWorkflow(pipelineId, {
|
|
160
|
+
previous_plugin_inst_id: options.previousPluginInstId,
|
|
161
|
+
nodes_info: JSON.stringify(nodes_info),
|
|
162
|
+
});
|
|
163
|
+
if (!workflow) {
|
|
164
|
+
errorStack_js_1.errorStack.stack_push('error', 'createWorkflow returned empty response');
|
|
165
|
+
return (0, result_js_1.Err)();
|
|
166
|
+
}
|
|
167
|
+
const workflowWithData = workflow;
|
|
168
|
+
const workflowId = workflowWithData.data.id;
|
|
169
|
+
const instancesResponse = await workflowWithData.getPluginInstances({ limit: 1000 });
|
|
170
|
+
const instances = instancesResponse.getItems();
|
|
171
|
+
const pluginInstanceIds = instances.map((inst) => inst.data.id);
|
|
172
|
+
return (0, result_js_1.Ok)({ workflowId, pluginInstanceIds });
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
176
|
+
errorStack_js_1.errorStack.stack_push('error', `pipeline_createWorkflow: ${msg}`);
|
|
177
|
+
return (0, result_js_1.Err)();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=chrisPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrisPipeline.js","sourceRoot":"","sources":["../../src/pipelines/chrisPipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AA0EH,wCAcC;AAQD,4CAmFC;AASD,0DAwEC;AAlQD,sEAAgE;AAChE,8EAAwE;AACxE,0DAAoD;AACpD,kDAAqD;AASrD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,0CAAkB;IACxD;QACE,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACrC,CAAC;CACF;AAJD,gDAIC;AA+CD;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAClC,MAAe;IAEf,IAAI,CAAC;QACH,MAAM,KAAK,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QAC3D,MAAM,MAAM,GAAyB,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC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CAAC,UAAU,CAAC,OAAO,EAAE,4BAA4B,GAAG,EAAE,CAAC,CAAC;QAClE,OAAO,IAAA,eAAG,GAAE,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ChRIS PluginMeta resources.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { ChRISResourceGroup } from '../resources/chrisResourceGroup.js';
|
|
6
|
+
/**
|
|
7
|
+
* Group handler for ChRIS plugin metas.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ChRISPluginMetaGroup extends ChRISResourceGroup {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file ChRIS PluginMeta resources.
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ChRISPluginMetaGroup = void 0;
|
|
8
|
+
const chrisResourceGroup_js_1 = require("../resources/chrisResourceGroup.js");
|
|
9
|
+
/**
|
|
10
|
+
* Group handler for ChRIS plugin metas.
|
|
11
|
+
*/
|
|
12
|
+
class ChRISPluginMetaGroup extends chrisResourceGroup_js_1.ChRISResourceGroup {
|
|
13
|
+
constructor() {
|
|
14
|
+
super('PluginMetas', 'getPluginMetas');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ChRISPluginMetaGroup = ChRISPluginMetaGroup;
|
|
18
|
+
//# sourceMappingURL=chrisPluginMetas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrisPluginMetas.js","sourceRoot":"","sources":["../../src/pluginmetas/chrisPluginMetas.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,8EAAwE;AAExE;;GAEG;AACH,MAAa,oBAAqB,SAAQ,0CAAkB;IAC1D;QACE,KAAK,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;IACzC,CAAC;CACF;AAJD,oDAIC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Resource group for the plugins belonging to a ChRIS plugin-meta.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { ChRISResourceGroup } from "../resources/chrisResourceGroup";
|
|
7
|
+
/**
|
|
8
|
+
* Group handler for ChRIS plugin metadata (PluginMeta).
|
|
9
|
+
*/
|
|
10
|
+
export declare class ChRISPluginMetaPluginGroup extends ChRISResourceGroup {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Resource group for the plugins belonging to a ChRIS plugin-meta.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ChRISPluginMetaPluginGroup = void 0;
|
|
9
|
+
const chrisResourceGroup_1 = require("../resources/chrisResourceGroup");
|
|
10
|
+
/**
|
|
11
|
+
* Group handler for ChRIS plugin metadata (PluginMeta).
|
|
12
|
+
*/
|
|
13
|
+
class ChRISPluginMetaPluginGroup extends chrisResourceGroup_1.ChRISResourceGroup {
|
|
14
|
+
constructor() {
|
|
15
|
+
super("PluginMetaPlugins", "getPluginMetas");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ChRISPluginMetaPluginGroup = ChRISPluginMetaPluginGroup;
|
|
19
|
+
//# sourceMappingURL=chrisPluginMetaPlugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrisPluginMetaPlugins.js","sourceRoot":"","sources":["../../src/plugins/chrisPluginMetaPlugins.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,wEAAqE;AAErE;;GAEG;AACH,MAAa,0BAA2B,SAAQ,uCAAkB;IAChE;QACE,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;IAC/C,CAAC;CACF;AAJD,gEAIC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ChRIS Plugin Management
|
|
3
|
+
*
|
|
4
|
+
* This module provides classes for managing ChRIS plugins.
|
|
5
|
+
* It includes the `ChRISPluginGroup` for collection operations and `ChRISPlugin` for individual plugin operations,
|
|
6
|
+
* such as searching for plugins and creating plugin instances.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import Client, { PluginInstance } from "@fnndsc/chrisapi";
|
|
11
|
+
import { Dictionary } from "../resources/chrisResources.js";
|
|
12
|
+
import { ChRISResourceGroup } from "../resources/chrisResourceGroup.js";
|
|
13
|
+
import { ChRISElementsGet, QueryHits, ChRISObjectParams } from "../utils/keypair.js";
|
|
14
|
+
import { Searchable } from "../utils/searchable.js";
|
|
15
|
+
import { Result } from "../utils/result.js";
|
|
16
|
+
/**
|
|
17
|
+
* Group handler for ChRIS plugins.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ChRISPluginGroup extends ChRISResourceGroup {
|
|
20
|
+
constructor();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Group handler for ChRIS plugin instances.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ChRISPluginInstanceGroup extends ChRISResourceGroup {
|
|
26
|
+
constructor();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Class for managing individual ChRIS plugins.
|
|
30
|
+
*/
|
|
31
|
+
export declare class ChRISPlugin {
|
|
32
|
+
private _client;
|
|
33
|
+
constructor();
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves the ChRIS client instance asynchronously.
|
|
36
|
+
* @returns A Promise resolving to the Client instance or null.
|
|
37
|
+
*/
|
|
38
|
+
client_get(): Promise<Client | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Converts a plain string to a searchable format.
|
|
41
|
+
* @deprecated Use Searchable.from() instead.
|
|
42
|
+
*/
|
|
43
|
+
pluginString_makeSearchable(plugin: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Resolves a searchable string or object to plugin IDs.
|
|
46
|
+
* @param pluginSearchable - A searchable string or Searchable object.
|
|
47
|
+
* @returns A Promise resolving to QueryHits containing matching plugin IDs.
|
|
48
|
+
*/
|
|
49
|
+
pluginIDs_resolve(pluginSearchable: string | Searchable): Promise<QueryHits | null>;
|
|
50
|
+
previousID_get(): Promise<number | null>;
|
|
51
|
+
plugin_runOnCUBE(pluginID: number, previousID: number, options: ChRISObjectParams): Promise<PluginInstance | undefined | null>;
|
|
52
|
+
pluginInstance_toDict(pluginInstance: PluginInstance | undefined | null): Dictionary | null;
|
|
53
|
+
plugin_run(plugin: string, params: string): Promise<Dictionary | null>;
|
|
54
|
+
pluginData_getFromSearch(searchOptions: ChRISElementsGet, dataField: string | string[]): Promise<QueryHits | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Gets plugin IDs from a searchable.
|
|
57
|
+
* @param searchable - A searchable string or Searchable object.
|
|
58
|
+
* @returns A Promise resolving to QueryHits containing matching plugin IDs.
|
|
59
|
+
*/
|
|
60
|
+
pluginIDs_getFromSearchable(searchable: string | Searchable): Promise<QueryHits | null>;
|
|
61
|
+
pluginIDs_get(name_exact: string): Promise<QueryHits | null>;
|
|
62
|
+
/**
|
|
63
|
+
* Uploads a plugin representation file to create a new plugin admin resource.
|
|
64
|
+
*
|
|
65
|
+
* Requires admin credentials. Will push error to errorStack if authentication fails.
|
|
66
|
+
*
|
|
67
|
+
* @param pluginData - Plugin descriptor JSON data.
|
|
68
|
+
* @param computeResources - Array of compute resource names to assign plugin to.
|
|
69
|
+
* @param adminToken - Optional admin authentication token (if different from current user).
|
|
70
|
+
* @returns Promise resolving to the created plugin data or null on failure.
|
|
71
|
+
*/
|
|
72
|
+
plugin_registerWithAdmin(pluginData: Record<string, unknown>, computeResources?: string[], adminToken?: string): Promise<Record<string, unknown> | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Searches for a plugin in a peer ChRIS store (public plugin repository).
|
|
75
|
+
*
|
|
76
|
+
* Uses anonymous client to query public plugin stores without authentication.
|
|
77
|
+
*
|
|
78
|
+
* @param pluginName - Name of the plugin to search for.
|
|
79
|
+
* @param version - Optional version of the plugin to search for.
|
|
80
|
+
* @param peerStoreUrl - URL of the peer ChRIS store (default: cube.chrisproject.org).
|
|
81
|
+
* @returns Promise resolving to plugin data and store URL, or null if not found.
|
|
82
|
+
*/
|
|
83
|
+
plugin_searchPeerStore(pluginName: string, version?: string, peerStoreUrl?: string): Promise<{
|
|
84
|
+
plugin: Record<string, unknown>;
|
|
85
|
+
storeUrl: string;
|
|
86
|
+
} | null>;
|
|
87
|
+
/**
|
|
88
|
+
* Checks if a plugin with given name or dock_image already exists in current CUBE.
|
|
89
|
+
*
|
|
90
|
+
* @param nameOrImage - Plugin name or docker image to search for.
|
|
91
|
+
* @returns Promise resolving to plugin data if found, null otherwise.
|
|
92
|
+
*/
|
|
93
|
+
plugin_existsInCube(nameOrImage: string): Promise<Record<string, unknown> | null>;
|
|
94
|
+
/**
|
|
95
|
+
* Lists plugins from a peer ChRIS store.
|
|
96
|
+
* Handles pagination to fetch all results.
|
|
97
|
+
*
|
|
98
|
+
* @param peerStoreUrl - URL of the peer store.
|
|
99
|
+
* @param searchParams - Optional search parameters.
|
|
100
|
+
* @returns Promise resolving to array of plugin data objects.
|
|
101
|
+
*/
|
|
102
|
+
plugin_listPeerStore(peerStoreUrl?: string, searchParams?: Record<string, string>): Promise<Record<string, unknown>[] | null>;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the compute resources currently assigned to a plugin.
|
|
105
|
+
*
|
|
106
|
+
* @param pluginId - ID of the plugin.
|
|
107
|
+
* @returns Promise resolving to array of compute resource names.
|
|
108
|
+
*/
|
|
109
|
+
plugin_getComputeResources(pluginId: number): Promise<string[]>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Registers a plugin using the legacy non-admin PluginList._post() method.
|
|
113
|
+
*
|
|
114
|
+
* **DEPRECATED:** This method uses the legacy non-admin plugin registration endpoint
|
|
115
|
+
* which may not be available in modern ChRIS CUBE installations. Prefer using
|
|
116
|
+
* ChRISPlugin.plugin_registerWithAdmin() instead.
|
|
117
|
+
*
|
|
118
|
+
* This function is provided for backward compatibility only and will be removed
|
|
119
|
+
* in a future release.
|
|
120
|
+
*
|
|
121
|
+
* @param pluginData - Plugin descriptor data (name, dock_image, etc.).
|
|
122
|
+
* @param computeResources - Optional array of compute resource names to assign.
|
|
123
|
+
* @returns A Result containing the registered plugin data, or an error.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated Use ChRISPlugin.plugin_registerWithAdmin() instead.
|
|
126
|
+
*/
|
|
127
|
+
export declare function plugin_registerDirect(pluginData: Record<string, unknown>, computeResources?: string[]): Promise<Result<Record<string, unknown>>>;
|