@fnndsc/salsa 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/compute/index.d.ts +17 -0
- package/dist/compute/index.js +33 -0
- package/dist/compute/index.js.map +1 -0
- package/dist/connect/index.d.ts +25 -0
- package/dist/connect/index.js +27 -0
- package/dist/connect/index.js.map +1 -0
- package/dist/context/index.d.ts +38 -0
- package/dist/context/index.js +58 -0
- package/dist/context/index.js.map +1 -0
- package/dist/feeds/index.d.ts +60 -0
- package/dist/feeds/index.js +101 -0
- package/dist/feeds/index.js.map +1 -0
- package/dist/files/index.d.ts +179 -0
- package/dist/files/index.js +562 -0
- package/dist/files/index.js.map +1 -0
- package/dist/files/pacs_content.d.ts +29 -0
- package/dist/files/pacs_content.js +121 -0
- package/dist/files/pacs_content.js.map +1 -0
- package/dist/files/pipeline_content.d.ts +22 -0
- package/dist/files/pipeline_content.js +31 -0
- package/dist/files/pipeline_content.js.map +1 -0
- package/dist/files/regular_content.d.ts +33 -0
- package/dist/files/regular_content.js +177 -0
- package/dist/files/regular_content.js.map +1 -0
- package/dist/groups/index.d.ts +21 -0
- package/dist/groups/index.js +37 -0
- package/dist/groups/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/index.d.ts +6 -0
- package/dist/jobs/index.js +17 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobOps.d.ts +108 -0
- package/dist/jobs/jobOps.js +307 -0
- package/dist/jobs/jobOps.js.map +1 -0
- package/dist/pacs/index.d.ts +64 -0
- package/dist/pacs/index.js +91 -0
- package/dist/pacs/index.js.map +1 -0
- package/dist/pacs/resultDecode.d.ts +13 -0
- package/dist/pacs/resultDecode.js +19 -0
- package/dist/pacs/resultDecode.js.map +1 -0
- package/dist/pipelines/index.d.ts +58 -0
- package/dist/pipelines/index.js +194 -0
- package/dist/pipelines/index.js.map +1 -0
- package/dist/plugininstances/index.d.ts +15 -0
- package/dist/plugininstances/index.js +27 -0
- package/dist/plugininstances/index.js.map +1 -0
- package/dist/pluginmetas/index.d.ts +21 -0
- package/dist/pluginmetas/index.js +37 -0
- package/dist/pluginmetas/index.js.map +1 -0
- package/dist/plugins/index.d.ts +118 -0
- package/dist/plugins/index.js +247 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/internal/plugin_executeContinueFeed.d.ts +17 -0
- package/dist/plugins/internal/plugin_executeContinueFeed.js +65 -0
- package/dist/plugins/internal/plugin_executeContinueFeed.js.map +1 -0
- package/dist/plugins/internal/plugin_executeNewFeed.d.ts +32 -0
- package/dist/plugins/internal/plugin_executeNewFeed.js +97 -0
- package/dist/plugins/internal/plugin_executeNewFeed.js.map +1 -0
- package/dist/plugins/peer_search.d.ts +65 -0
- package/dist/plugins/peer_search.js +94 -0
- package/dist/plugins/peer_search.js.map +1 -0
- package/dist/plugins/plugin_executeInPlace.d.ts +69 -0
- package/dist/plugins/plugin_executeInPlace.js +66 -0
- package/dist/plugins/plugin_executeInPlace.js.map +1 -0
- package/dist/plugins/plugin_register.d.ts +64 -0
- package/dist/plugins/plugin_register.js +121 -0
- package/dist/plugins/plugin_register.js.map +1 -0
- package/dist/plugins/store_import.d.ts +64 -0
- package/dist/plugins/store_import.js +196 -0
- package/dist/plugins/store_import.js.map +1 -0
- package/dist/store/index.d.ts +15 -0
- package/dist/store/index.js +37 -0
- package/dist/store/index.js.map +1 -0
- package/dist/tags/index.d.ts +21 -0
- package/dist/tags/index.js +37 -0
- package/dist/tags/index.js.map +1 -0
- package/dist/vfs/dispatcher.d.ts +83 -0
- package/dist/vfs/dispatcher.js +192 -0
- package/dist/vfs/dispatcher.js.map +1 -0
- package/dist/vfs/index.d.ts +9 -0
- package/dist/vfs/index.js +26 -0
- package/dist/vfs/index.js.map +1 -0
- package/dist/vfs/provider.d.ts +80 -0
- package/dist/vfs/provider.js +11 -0
- package/dist/vfs/provider.js.map +1 -0
- package/dist/vfs/providers/etc.d.ts +44 -0
- package/dist/vfs/providers/etc.js +119 -0
- package/dist/vfs/providers/etc.js.map +1 -0
- package/dist/vfs/providers/native.d.ts +34 -0
- package/dist/vfs/providers/native.js +168 -0
- package/dist/vfs/providers/native.js.map +1 -0
- package/dist/vfs/providers/pacs.d.ts +56 -0
- package/dist/vfs/providers/pacs.js +413 -0
- package/dist/vfs/providers/pacs.js.map +1 -0
- package/dist/vfs/providers/pacsHelpers.d.ts +27 -0
- package/dist/vfs/providers/pacsHelpers.js +108 -0
- package/dist/vfs/providers/pacsHelpers.js.map +1 -0
- package/dist/vfs/providers/pacs_content.d.ts +27 -0
- package/dist/vfs/providers/pacs_content.js +137 -0
- package/dist/vfs/providers/pacs_content.js.map +1 -0
- package/dist/vfs/providers/proc.d.ts +62 -0
- package/dist/vfs/providers/proc.js +478 -0
- package/dist/vfs/providers/proc.js.map +1 -0
- package/dist/workflows/index.d.ts +21 -0
- package/dist/workflows/index.js +37 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Plugin Execution In Place
|
|
3
|
+
*
|
|
4
|
+
* This module provides the high-level "execute plugin in place" intent,
|
|
5
|
+
* which runs a plugin based on the current working directory context.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { Dictionary } from '@fnndsc/cumin';
|
|
10
|
+
/**
|
|
11
|
+
* Result of plugin execution in place.
|
|
12
|
+
*/
|
|
13
|
+
export interface PluginExecutionResult {
|
|
14
|
+
/** Feed ID (present if new feed was created) */
|
|
15
|
+
feedID?: number;
|
|
16
|
+
/** Dircopy plugin instance ID (present if new feed was created) */
|
|
17
|
+
dircopyInstanceID?: number;
|
|
18
|
+
/** The scheduled plugin instance ID */
|
|
19
|
+
pluginInstanceID: number;
|
|
20
|
+
/** The plugin name that was executed */
|
|
21
|
+
pluginName: string;
|
|
22
|
+
/** Path where output will appear */
|
|
23
|
+
outputPath: string;
|
|
24
|
+
/** Parent instance ID — null for feed root nodes, set for all others */
|
|
25
|
+
parentID: number | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Executes a plugin "in place" based on current working directory context.
|
|
29
|
+
*
|
|
30
|
+
* This function orchestrates plugin execution with implicit context from the
|
|
31
|
+
* filesystem path. It handles two scenarios:
|
|
32
|
+
*
|
|
33
|
+
* 1. **New Analysis (non-feed directory):**
|
|
34
|
+
* - Creates a new feed via pl-dircopy of the current directory
|
|
35
|
+
* - Runs the plugin with the dircopy instance as previous_id
|
|
36
|
+
*
|
|
37
|
+
* 2. **Continue Analysis (feed directory):**
|
|
38
|
+
* - Extracts plugin instance ID from the directory path
|
|
39
|
+
* - Runs the plugin with the extracted previous_id
|
|
40
|
+
*
|
|
41
|
+
* @param pluginName - Full plugin name with version (e.g., pl-dcm2niix-v2.1.1).
|
|
42
|
+
* @param pluginParams - Dictionary of plugin parameters.
|
|
43
|
+
* @param contextParams - Dictionary of context parameters (feed_title, instance_title, etc.).
|
|
44
|
+
* @param cwd - Current working directory.
|
|
45
|
+
* @param binListing - Array of plugin names from /bin (for finding pl-dircopy).
|
|
46
|
+
* @returns Promise resolving to execution result, or null on failure.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // New analysis
|
|
51
|
+
* const result = await plugin_executeInPlace(
|
|
52
|
+
* 'pl-dcm2niix-v2.1.1',
|
|
53
|
+
* { outputdir: 'results' },
|
|
54
|
+
* { feed_title: 'Brain MRI Study' },
|
|
55
|
+
* '/home/chris/uploads/SAG-anon',
|
|
56
|
+
* binListing
|
|
57
|
+
* );
|
|
58
|
+
*
|
|
59
|
+
* // Continue analysis
|
|
60
|
+
* const result = await plugin_executeInPlace(
|
|
61
|
+
* 'pl-segmentation-v1.0.0',
|
|
62
|
+
* { threshold: '0.5' },
|
|
63
|
+
* { instance_title: 'Segment Cortex' },
|
|
64
|
+
* '/home/chris/feeds/feed_123/pl-dircopy_456/data/',
|
|
65
|
+
* binListing
|
|
66
|
+
* );
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function plugin_executeInPlace(pluginName: string, pluginParams: Dictionary, contextParams: Dictionary, cwd: string, binListing: string[]): Promise<PluginExecutionResult | null>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Plugin Execution In Place
|
|
4
|
+
*
|
|
5
|
+
* This module provides the high-level "execute plugin in place" intent,
|
|
6
|
+
* which runs a plugin based on the current working directory context.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.plugin_executeInPlace = plugin_executeInPlace;
|
|
12
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
13
|
+
const plugin_executeNewFeed_js_1 = require("./internal/plugin_executeNewFeed.js");
|
|
14
|
+
const plugin_executeContinueFeed_js_1 = require("./internal/plugin_executeContinueFeed.js");
|
|
15
|
+
/**
|
|
16
|
+
* Executes a plugin "in place" based on current working directory context.
|
|
17
|
+
*
|
|
18
|
+
* This function orchestrates plugin execution with implicit context from the
|
|
19
|
+
* filesystem path. It handles two scenarios:
|
|
20
|
+
*
|
|
21
|
+
* 1. **New Analysis (non-feed directory):**
|
|
22
|
+
* - Creates a new feed via pl-dircopy of the current directory
|
|
23
|
+
* - Runs the plugin with the dircopy instance as previous_id
|
|
24
|
+
*
|
|
25
|
+
* 2. **Continue Analysis (feed directory):**
|
|
26
|
+
* - Extracts plugin instance ID from the directory path
|
|
27
|
+
* - Runs the plugin with the extracted previous_id
|
|
28
|
+
*
|
|
29
|
+
* @param pluginName - Full plugin name with version (e.g., pl-dcm2niix-v2.1.1).
|
|
30
|
+
* @param pluginParams - Dictionary of plugin parameters.
|
|
31
|
+
* @param contextParams - Dictionary of context parameters (feed_title, instance_title, etc.).
|
|
32
|
+
* @param cwd - Current working directory.
|
|
33
|
+
* @param binListing - Array of plugin names from /bin (for finding pl-dircopy).
|
|
34
|
+
* @returns Promise resolving to execution result, or null on failure.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // New analysis
|
|
39
|
+
* const result = await plugin_executeInPlace(
|
|
40
|
+
* 'pl-dcm2niix-v2.1.1',
|
|
41
|
+
* { outputdir: 'results' },
|
|
42
|
+
* { feed_title: 'Brain MRI Study' },
|
|
43
|
+
* '/home/chris/uploads/SAG-anon',
|
|
44
|
+
* binListing
|
|
45
|
+
* );
|
|
46
|
+
*
|
|
47
|
+
* // Continue analysis
|
|
48
|
+
* const result = await plugin_executeInPlace(
|
|
49
|
+
* 'pl-segmentation-v1.0.0',
|
|
50
|
+
* { threshold: '0.5' },
|
|
51
|
+
* { instance_title: 'Segment Cortex' },
|
|
52
|
+
* '/home/chris/feeds/feed_123/pl-dircopy_456/data/',
|
|
53
|
+
* binListing
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
async function plugin_executeInPlace(pluginName, pluginParams, contextParams, cwd, binListing) {
|
|
58
|
+
const isInFeed = (0, cumin_1.path_isInFeed)(cwd);
|
|
59
|
+
if (!isInFeed) {
|
|
60
|
+
return (0, plugin_executeNewFeed_js_1.plugin_executeNewFeed)(pluginName, pluginParams, contextParams, cwd, binListing);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return (0, plugin_executeContinueFeed_js_1.plugin_executeContinueFeed)(pluginName, pluginParams, contextParams, cwd);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=plugin_executeInPlace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin_executeInPlace.js","sourceRoot":"","sources":["../../src/plugins/plugin_executeInPlace.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAqEH,sDAyBC;AA5FD,yCAGuB;AACvB,kFAA4E;AAC5E,4FAAsF;AAoBtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACI,KAAK,UAAU,qBAAqB,CACzC,UAAkB,EAClB,YAAwB,EACxB,aAAyB,EACzB,GAAW,EACX,UAAoB;IAEpB,MAAM,QAAQ,GAAY,IAAA,qBAAa,EAAC,GAAG,CAAC,CAAC;IAE7C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAA,gDAAqB,EAC1B,UAAU,EACV,YAAY,EACZ,aAAa,EACb,GAAG,EACH,UAAU,CACX,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAA,0DAA0B,EAC/B,UAAU,EACV,YAAY,EACZ,aAAa,EACb,GAAG,CACJ,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Plugin registration logic, including admin-credentialed registration.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { AdminCredentials } from './store_import.js';
|
|
7
|
+
/**
|
|
8
|
+
* Interface for plugin registration data.
|
|
9
|
+
*/
|
|
10
|
+
export interface PluginRegistrationData {
|
|
11
|
+
name: string;
|
|
12
|
+
dock_image: string;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interface for plugin registration response.
|
|
17
|
+
*/
|
|
18
|
+
export interface PluginRegistrationResponse {
|
|
19
|
+
name: string;
|
|
20
|
+
id?: number;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Registers a new plugin with ChRIS CUBE using admin endpoint.
|
|
25
|
+
*
|
|
26
|
+
* This is the enhanced version that uses the admin API for registration.
|
|
27
|
+
* Requires admin credentials.
|
|
28
|
+
*
|
|
29
|
+
* @param pluginData - The JSON payload representing the plugin's descriptor.
|
|
30
|
+
* @param computeResources - Optional array of compute resource names to assign the plugin to.
|
|
31
|
+
* @param adminCreds - Optional admin credentials for registration.
|
|
32
|
+
* @returns A Promise resolving to the registered plugin's data, or null on failure.
|
|
33
|
+
*/
|
|
34
|
+
export declare function plugin_registerWithAdmin(pluginData: PluginRegistrationData, computeResources?: string[], adminCreds?: AdminCredentials): Promise<PluginRegistrationResponse | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Registers a new plugin with ChRIS CUBE (legacy method, non-admin).
|
|
37
|
+
*
|
|
38
|
+
* This method uses the non-admin plugin endpoint which may not be available
|
|
39
|
+
* in all CUBE configurations. Prefer using plugin_registerWithAdmin instead.
|
|
40
|
+
*
|
|
41
|
+
* @param pluginData - The JSON payload representing the plugin's descriptor.
|
|
42
|
+
* @param computeResources - Optional array of compute resource names to assign the plugin to.
|
|
43
|
+
* @returns A Promise resolving to the registered plugin's data, or null on failure.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Use plugin_registerWithAdmin instead for better compatibility.
|
|
46
|
+
*/
|
|
47
|
+
export declare function plugin_register(pluginData: PluginRegistrationData, computeResources?: string[]): Promise<PluginRegistrationResponse | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Checks if a plugin already exists in CUBE and returns its data.
|
|
50
|
+
*
|
|
51
|
+
* @param nameOrImage - Plugin name or Docker image to search for.
|
|
52
|
+
* @returns Promise resolving to plugin data if found, null otherwise.
|
|
53
|
+
*/
|
|
54
|
+
export declare function plugin_checkExists(nameOrImage: string): Promise<PluginRegistrationResponse | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Assigns a plugin to additional compute resources (cumulative).
|
|
57
|
+
*
|
|
58
|
+
* Does not remove existing compute resource assignments, only adds new ones.
|
|
59
|
+
*
|
|
60
|
+
* @param pluginId - ID of the plugin.
|
|
61
|
+
* @param computeResources - Array of compute resource names to add.
|
|
62
|
+
* @returns Promise resolving to success boolean.
|
|
63
|
+
*/
|
|
64
|
+
export declare function plugin_assignToComputeResources(pluginId: number, computeResources: string[]): Promise<boolean>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Plugin registration logic, including admin-credentialed registration.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.plugin_registerWithAdmin = plugin_registerWithAdmin;
|
|
9
|
+
exports.plugin_register = plugin_register;
|
|
10
|
+
exports.plugin_checkExists = plugin_checkExists;
|
|
11
|
+
exports.plugin_assignToComputeResources = plugin_assignToComputeResources;
|
|
12
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
13
|
+
/**
|
|
14
|
+
* Registers a new plugin with ChRIS CUBE using admin endpoint.
|
|
15
|
+
*
|
|
16
|
+
* This is the enhanced version that uses the admin API for registration.
|
|
17
|
+
* Requires admin credentials.
|
|
18
|
+
*
|
|
19
|
+
* @param pluginData - The JSON payload representing the plugin's descriptor.
|
|
20
|
+
* @param computeResources - Optional array of compute resource names to assign the plugin to.
|
|
21
|
+
* @param adminCreds - Optional admin credentials for registration.
|
|
22
|
+
* @returns A Promise resolving to the registered plugin's data, or null on failure.
|
|
23
|
+
*/
|
|
24
|
+
async function plugin_registerWithAdmin(pluginData, computeResources = ['host'], adminCreds) {
|
|
25
|
+
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
26
|
+
let adminToken;
|
|
27
|
+
if (adminCreds && adminCreds.username && adminCreds.password) {
|
|
28
|
+
const client = await chrisPlugin.client_get();
|
|
29
|
+
if (client) {
|
|
30
|
+
const authUrl = client.url + 'auth-token/';
|
|
31
|
+
try {
|
|
32
|
+
const token = await cumin_1.Client.getAuthToken(authUrl, adminCreds.username, adminCreds.password);
|
|
33
|
+
if (token) {
|
|
34
|
+
adminToken = token;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
39
|
+
cumin_1.errorStack.stack_push('warning', `Failed to get admin token: ${msg}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const result = await chrisPlugin.plugin_registerWithAdmin(pluginData, computeResources, adminToken);
|
|
44
|
+
if (result) {
|
|
45
|
+
console.log(`Plugin '${result.name}' registered successfully.`);
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Registers a new plugin with ChRIS CUBE (legacy method, non-admin).
|
|
52
|
+
*
|
|
53
|
+
* This method uses the non-admin plugin endpoint which may not be available
|
|
54
|
+
* in all CUBE configurations. Prefer using plugin_registerWithAdmin instead.
|
|
55
|
+
*
|
|
56
|
+
* @param pluginData - The JSON payload representing the plugin's descriptor.
|
|
57
|
+
* @param computeResources - Optional array of compute resource names to assign the plugin to.
|
|
58
|
+
* @returns A Promise resolving to the registered plugin's data, or null on failure.
|
|
59
|
+
*
|
|
60
|
+
* @deprecated Use plugin_registerWithAdmin instead for better compatibility.
|
|
61
|
+
*/
|
|
62
|
+
async function plugin_register(pluginData, computeResources) {
|
|
63
|
+
const result = await (0, cumin_1.plugin_registerDirect)(pluginData, computeResources);
|
|
64
|
+
if (result.ok) {
|
|
65
|
+
console.log(`Plugin '${result.value.name}' registered successfully.`);
|
|
66
|
+
return result.value;
|
|
67
|
+
}
|
|
68
|
+
// Error already pushed to errorStack by cumin
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Checks if a plugin already exists in CUBE and returns its data.
|
|
73
|
+
*
|
|
74
|
+
* @param nameOrImage - Plugin name or Docker image to search for.
|
|
75
|
+
* @returns Promise resolving to plugin data if found, null otherwise.
|
|
76
|
+
*/
|
|
77
|
+
async function plugin_checkExists(nameOrImage) {
|
|
78
|
+
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
79
|
+
const existingPlugin = await chrisPlugin.plugin_existsInCube(nameOrImage);
|
|
80
|
+
if (existingPlugin) {
|
|
81
|
+
return existingPlugin;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Assigns a plugin to additional compute resources (cumulative).
|
|
87
|
+
*
|
|
88
|
+
* Does not remove existing compute resource assignments, only adds new ones.
|
|
89
|
+
*
|
|
90
|
+
* @param pluginId - ID of the plugin.
|
|
91
|
+
* @param computeResources - Array of compute resource names to add.
|
|
92
|
+
* @returns Promise resolving to success boolean.
|
|
93
|
+
*/
|
|
94
|
+
async function plugin_assignToComputeResources(pluginId, computeResources) {
|
|
95
|
+
try {
|
|
96
|
+
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
97
|
+
const currentResources = await chrisPlugin.plugin_getComputeResources(pluginId);
|
|
98
|
+
// Determine new resources to add (avoid duplicates)
|
|
99
|
+
const newResources = computeResources.filter((name) => !currentResources.includes(name));
|
|
100
|
+
if (newResources.length === 0) {
|
|
101
|
+
console.log(`Plugin already assigned to: ${computeResources.join(', ')}`);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
// Combine all resources (cumulative)
|
|
105
|
+
const allResources = [...currentResources, ...newResources];
|
|
106
|
+
// Note: @fnndsc/chrisapi doesn't directly expose compute resource modification
|
|
107
|
+
// We would need to use admin API to modify plugin compute resources
|
|
108
|
+
// For now, this is a placeholder that logs the action
|
|
109
|
+
console.log(`Adding plugin to compute resources: ${newResources.join(', ')}`);
|
|
110
|
+
console.log(`Full resource list: ${allResources.join(', ')}`);
|
|
111
|
+
// TODO: Implement actual compute resource assignment via admin API
|
|
112
|
+
cumin_1.errorStack.stack_push('warning', 'Compute resource assignment not fully implemented. Plugin may need manual assignment.');
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
117
|
+
cumin_1.errorStack.stack_push('error', `Failed to assign compute resources: ${errorMessage}`);
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=plugin_register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin_register.js","sourceRoot":"","sources":["../../src/plugins/plugin_register.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAkCH,4DAwCC;AAcD,0CAgBC;AAQD,gDAWC;AAWD,0EAwCC;AA5KD,yCAA+F;AAqB/F;;;;;;;;;;GAUG;AACI,KAAK,UAAU,wBAAwB,CAC5C,UAAkC,EAClC,mBAA6B,CAAC,MAAM,CAAC,EACrC,UAA6B;IAE7B,MAAM,WAAW,GAAgB,IAAI,mBAAW,EAAE,CAAC;IACnD,IAAI,UAA8B,CAAC;IAEnC,IAAI,UAAU,IAAI,UAAU,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC7D,MAAM,MAAM,GAAkB,MAAM,WAAW,CAAC,UAAU,EAAE,CAAC;QAC7D,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,OAAO,GAAW,MAAM,CAAC,GAAG,GAAG,aAAa,CAAC;YACnD,IAAI,CAAC;gBACH,MAAM,KAAK,GAAW,MAAM,cAAM,CAAC,YAAY,CAC7C,OAAO,EACP,UAAU,CAAC,QAAQ,EACnB,UAAU,CAAC,QAAQ,CACpB,CAAC;gBACF,IAAI,KAAK,EAAE,CAAC;oBACV,UAAU,GAAG,KAAK,CAAC;gBACrB,CAAC;YACH,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,MAAM,GAAG,GAAW,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC/D,kBAAU,CAAC,UAAU,CAAC,SAAS,EAAE,8BAA8B,GAAG,EAAE,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAA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CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CACnD,CAAC;QAEF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,+BAA+B,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,qCAAqC;QACrC,MAAM,YAAY,GAAa,CAAC,GAAG,gBAAgB,EAAE,GAAG,YAAY,CAAC,CAAC;QAEtE,+EAA+E;QAC/E,oEAAoE;QACpE,sDAAsD;QACtD,OAAO,CAAC,GAAG,CAAC,uCAAuC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9E,OAAO,CAAC,GAAG,CAAC,uBAAuB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAE9D,mEAAmE;QACnE,kBAAU,CAAC,UAAU,CACnB,SAAS,EACT,uFAAuF,CACxF,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,YAAY,GAAW,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpF,kBAAU,CAAC,UAAU,CAAC,OAAO,EAAE,uCAAuC,YAAY,EAAE,CAAC,CAAC;QACtF,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Plugin Import from Store
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality to import plugins from peer ChRIS stores
|
|
5
|
+
* directly, without needing to extract from Docker images. This is faster and
|
|
6
|
+
* more reliable than Docker extraction when the plugin already exists in a
|
|
7
|
+
* public store.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Credentials for admin authentication.
|
|
13
|
+
*/
|
|
14
|
+
export interface AdminCredentials {
|
|
15
|
+
username?: string;
|
|
16
|
+
password?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Interface for plugin import result.
|
|
20
|
+
*/
|
|
21
|
+
export interface PluginImportResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
plugin?: Record<string, unknown>;
|
|
24
|
+
requiresAuth?: boolean;
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Imports a plugin from a peer store URL.
|
|
29
|
+
*
|
|
30
|
+
* Note: ChRIS CUBE may or may not support direct import from store URLs.
|
|
31
|
+
* This function attempts import and falls back to providing plugin data
|
|
32
|
+
* for manual registration if direct import is not supported.
|
|
33
|
+
*
|
|
34
|
+
* @param storeUrl - URL of the plugin in the peer store.
|
|
35
|
+
* @param pluginData - Plugin data from peer store.
|
|
36
|
+
* @param computeResources - Array of compute resource names to assign plugin to.
|
|
37
|
+
* @param adminCreds - Optional admin credentials for registration.
|
|
38
|
+
* @returns Promise resolving to import result.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const result = await plugin_importFromStore(
|
|
43
|
+
* 'https://cube.chrisproject.org/api/v1/plugins/96/',
|
|
44
|
+
* pluginData,
|
|
45
|
+
* ['host', 'gpu'],
|
|
46
|
+
* { username: 'admin', password: 'password' }
|
|
47
|
+
* );
|
|
48
|
+
* if (result.success) {
|
|
49
|
+
* console.log('Plugin imported successfully');
|
|
50
|
+
* } else if (result.requiresAuth) {
|
|
51
|
+
* // Prompt for admin credentials
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function plugin_importFromStore(storeUrl: string, pluginData: Record<string, unknown>, computeResources?: string[], adminCreds?: AdminCredentials): Promise<PluginImportResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if plugin store URL import is supported by the current CUBE instance.
|
|
58
|
+
*
|
|
59
|
+
* Note: This is a placeholder for future enhancement. Currently always returns false
|
|
60
|
+
* as the feature availability depends on CUBE version and configuration.
|
|
61
|
+
*
|
|
62
|
+
* @returns Promise resolving to true if store import is supported, false otherwise.
|
|
63
|
+
*/
|
|
64
|
+
export declare function storeImport_isSupported(): Promise<boolean>;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Plugin Import from Store
|
|
4
|
+
*
|
|
5
|
+
* This module provides functionality to import plugins from peer ChRIS stores
|
|
6
|
+
* directly, without needing to extract from Docker images. This is faster and
|
|
7
|
+
* more reliable than Docker extraction when the plugin already exists in a
|
|
8
|
+
* public store.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.plugin_importFromStore = plugin_importFromStore;
|
|
14
|
+
exports.storeImport_isSupported = storeImport_isSupported;
|
|
15
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
16
|
+
/**
|
|
17
|
+
* Whitelist of fields to keep from peer store plugin data.
|
|
18
|
+
* Removes read-only fields like id, creation_date, stars, etc.
|
|
19
|
+
*/
|
|
20
|
+
const PLUGIN_FIELD_WHITELIST = [
|
|
21
|
+
'name', 'dock_image', 'public_repo', 'version',
|
|
22
|
+
'title', 'category', 'description', 'documentation', 'license', 'icon',
|
|
23
|
+
'execshell', 'selfpath', 'selfexec',
|
|
24
|
+
'min_number_of_workers', 'max_number_of_workers',
|
|
25
|
+
'min_cpu_limit', 'max_cpu_limit',
|
|
26
|
+
'min_memory_limit', 'max_memory_limit',
|
|
27
|
+
'min_gpu_limit', 'max_gpu_limit',
|
|
28
|
+
'type', 'authors', 'parameters'
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Imports a plugin from a peer store URL.
|
|
32
|
+
*
|
|
33
|
+
* Note: ChRIS CUBE may or may not support direct import from store URLs.
|
|
34
|
+
* This function attempts import and falls back to providing plugin data
|
|
35
|
+
* for manual registration if direct import is not supported.
|
|
36
|
+
*
|
|
37
|
+
* @param storeUrl - URL of the plugin in the peer store.
|
|
38
|
+
* @param pluginData - Plugin data from peer store.
|
|
39
|
+
* @param computeResources - Array of compute resource names to assign plugin to.
|
|
40
|
+
* @param adminCreds - Optional admin credentials for registration.
|
|
41
|
+
* @returns Promise resolving to import result.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const result = await plugin_importFromStore(
|
|
46
|
+
* 'https://cube.chrisproject.org/api/v1/plugins/96/',
|
|
47
|
+
* pluginData,
|
|
48
|
+
* ['host', 'gpu'],
|
|
49
|
+
* { username: 'admin', password: 'password' }
|
|
50
|
+
* );
|
|
51
|
+
* if (result.success) {
|
|
52
|
+
* console.log('Plugin imported successfully');
|
|
53
|
+
* } else if (result.requiresAuth) {
|
|
54
|
+
* // Prompt for admin credentials
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
async function plugin_importFromStore(storeUrl, pluginData, computeResources = ['host'], adminCreds) {
|
|
59
|
+
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
60
|
+
if (!pluginData.parameters && pluginData.links) {
|
|
61
|
+
const links = pluginData.links;
|
|
62
|
+
const paramsLink = links.find((l) => l.rel === 'parameters');
|
|
63
|
+
if (paramsLink) {
|
|
64
|
+
const paramsResult = await parameters_fetchFromUrl(paramsLink.href);
|
|
65
|
+
if (paramsResult.ok && paramsResult.value.length > 0) {
|
|
66
|
+
pluginData.parameters = paramsResult.value;
|
|
67
|
+
}
|
|
68
|
+
else if (!paramsResult.ok) {
|
|
69
|
+
console.log(`Warning: Failed to fetch parameters from ${paramsLink.href}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Sanitize plugin data to remove read-only fields
|
|
74
|
+
const sanitizedData = {};
|
|
75
|
+
PLUGIN_FIELD_WHITELIST.forEach(field => {
|
|
76
|
+
if (Object.prototype.hasOwnProperty.call(pluginData, field)) {
|
|
77
|
+
sanitizedData[field] = pluginData[field];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
let adminToken;
|
|
81
|
+
if (adminCreds && adminCreds.username && adminCreds.password) {
|
|
82
|
+
const client = await chrisPlugin.client_get();
|
|
83
|
+
if (client) {
|
|
84
|
+
const authUrl = client.url + 'auth-token/';
|
|
85
|
+
try {
|
|
86
|
+
const token = await cumin_1.Client.getAuthToken(authUrl, adminCreds.username, adminCreds.password);
|
|
87
|
+
if (token) {
|
|
88
|
+
adminToken = token;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
93
|
+
cumin_1.errorStack.stack_push('warning', `Failed to get admin token: ${msg}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const registeredPlugin = await chrisPlugin.plugin_registerWithAdmin(sanitizedData, computeResources, adminToken);
|
|
98
|
+
if (registeredPlugin) {
|
|
99
|
+
return {
|
|
100
|
+
success: true,
|
|
101
|
+
plugin: registeredPlugin
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
// Check if failure was due to authentication
|
|
105
|
+
const errors = cumin_1.errorStack.allOfType_get('error');
|
|
106
|
+
const authError = errors.some((e) => {
|
|
107
|
+
const lowerE = e.toLowerCase();
|
|
108
|
+
return lowerE.includes('unauthorized') ||
|
|
109
|
+
lowerE.includes('forbidden') ||
|
|
110
|
+
lowerE.includes('permission denied') ||
|
|
111
|
+
lowerE.includes('401') ||
|
|
112
|
+
lowerE.includes('403') ||
|
|
113
|
+
lowerE.includes('admin credentials required');
|
|
114
|
+
});
|
|
115
|
+
if (authError) {
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
requiresAuth: true,
|
|
119
|
+
errorMessage: 'Admin credentials required to import plugin from store.'
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
success: false,
|
|
124
|
+
errorMessage: 'Failed to import plugin from store.'
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Maps API parameter types to descriptor types.
|
|
129
|
+
*/
|
|
130
|
+
const TYPE_MAPPING = {
|
|
131
|
+
'string': 'str',
|
|
132
|
+
'integer': 'int',
|
|
133
|
+
'float': 'float',
|
|
134
|
+
'boolean': 'bool',
|
|
135
|
+
'path': 'path',
|
|
136
|
+
'unextpath': 'unextpath'
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Fetches parameters from a peer store URL and transforms them for registration.
|
|
140
|
+
*
|
|
141
|
+
* @param url - The parameters URL (Collection+JSON).
|
|
142
|
+
* @returns Promise resolving to array of parameter objects.
|
|
143
|
+
*/
|
|
144
|
+
async function parameters_fetchFromUrl(url) {
|
|
145
|
+
const response = await fetch(url, {
|
|
146
|
+
headers: { 'Accept': 'application/vnd.collection+json' }
|
|
147
|
+
});
|
|
148
|
+
if (!response.ok) {
|
|
149
|
+
cumin_1.errorStack.stack_push('error', `parameters_fetchFromUrl: HTTP error ${response.status}`);
|
|
150
|
+
return (0, cumin_1.Err)();
|
|
151
|
+
}
|
|
152
|
+
const data = await response.json();
|
|
153
|
+
const params = [];
|
|
154
|
+
if (collectionJson_is(data) && data.collection.items) {
|
|
155
|
+
data.collection.items.forEach((item) => {
|
|
156
|
+
const paramObj = {};
|
|
157
|
+
if (item.data) {
|
|
158
|
+
item.data.forEach((datum) => {
|
|
159
|
+
paramObj[datum.name] = datum.value;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Clean up parameter object (remove id, plugin_id, etc if necessary)
|
|
163
|
+
delete paramObj['id'];
|
|
164
|
+
delete paramObj['plugin'];
|
|
165
|
+
if (paramObj['type'] && typeof paramObj['type'] === 'string') {
|
|
166
|
+
const typeStr = paramObj['type'];
|
|
167
|
+
if (TYPE_MAPPING[typeStr]) {
|
|
168
|
+
paramObj['type'] = TYPE_MAPPING[typeStr];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
params.push(paramObj);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return (0, cumin_1.Ok)(params);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Type guard for CollectionJson.
|
|
178
|
+
*/
|
|
179
|
+
function collectionJson_is(data) {
|
|
180
|
+
return (typeof data === 'object' &&
|
|
181
|
+
data !== null &&
|
|
182
|
+
'collection' in data &&
|
|
183
|
+
typeof data.collection === 'object');
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Checks if plugin store URL import is supported by the current CUBE instance.
|
|
187
|
+
*
|
|
188
|
+
* Note: This is a placeholder for future enhancement. Currently always returns false
|
|
189
|
+
* as the feature availability depends on CUBE version and configuration.
|
|
190
|
+
*
|
|
191
|
+
* @returns Promise resolving to true if store import is supported, false otherwise.
|
|
192
|
+
*/
|
|
193
|
+
async function storeImport_isSupported() {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=store_import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store_import.js","sourceRoot":"","sources":["../../src/plugins/store_import.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAwEH,wDAwFC;AA8GD,0DAEC;AA9QD,yCAAiF;AA2BjF;;;GAGG;AACH,MAAM,sBAAsB,GAAa;IACvC,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS;IAC9C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM;IACtE,WAAW,EAAE,UAAU,EAAE,UAAU;IACnC,uBAAuB,EAAE,uBAAuB;IAChD,eAAe,EAAE,eAAe;IAChC,kBAAkB,EAAE,kBAAkB;IACtC,eAAe,EAAE,eAAe;IAChC,MAAM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eUrl - Optional URL of the peer store.
|
|
5
|
+
* @returns Promise resolving to array of raw plugin objects.
|
|
6
|
+
*/
|
|
7
|
+
export declare function store_list(storeUrl?: string): Promise<Record<string, unknown>[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Searches plugins in the peer store.
|
|
10
|
+
*
|
|
11
|
+
* @param query - Search query (e.g. plugin name substring).
|
|
12
|
+
* @param storeUrl - Optional URL of the peer store.
|
|
13
|
+
* @returns Promise resolving to array of raw plugin objects.
|
|
14
|
+
*/
|
|
15
|
+
export declare function store_search(query: string, storeUrl?: string): Promise<Record<string, unknown>[]>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.store_list = store_list;
|
|
4
|
+
exports.store_search = store_search;
|
|
5
|
+
/**
|
|
6
|
+
* @file Store operations.
|
|
7
|
+
*
|
|
8
|
+
* Logic for interacting with the peer ChRIS store (listing, searching).
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
13
|
+
/**
|
|
14
|
+
* Lists plugins from the peer store.
|
|
15
|
+
*
|
|
16
|
+
* @param storeUrl - Optional URL of the peer store.
|
|
17
|
+
* @returns Promise resolving to array of raw plugin objects.
|
|
18
|
+
*/
|
|
19
|
+
async function store_list(storeUrl) {
|
|
20
|
+
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
21
|
+
const plugins = await chrisPlugin.plugin_listPeerStore(storeUrl);
|
|
22
|
+
return plugins || [];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Searches plugins in the peer store.
|
|
26
|
+
*
|
|
27
|
+
* @param query - Search query (e.g. plugin name substring).
|
|
28
|
+
* @param storeUrl - Optional URL of the peer store.
|
|
29
|
+
* @returns Promise resolving to array of raw plugin objects.
|
|
30
|
+
*/
|
|
31
|
+
async function store_search(query, storeUrl) {
|
|
32
|
+
const chrisPlugin = new cumin_1.ChRISPlugin();
|
|
33
|
+
// Search by name
|
|
34
|
+
const plugins = await chrisPlugin.plugin_listPeerStore(storeUrl, { name: query });
|
|
35
|
+
return plugins || [];
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":";;AAeA,gCAIC;AASD,oCAKC;AAjCD;;;;;;GAMG;AACH,yCAA4C;AAE5C;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAAC,QAAiB;IAChD,MAAM,WAAW,GAAgB,IAAI,mBAAW,EAAE,CAAC;IACnD,MAAM,OAAO,GAAqC,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACnG,OAAO,OAAO,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAAC,KAAa,EAAE,QAAiB;IACjE,MAAM,WAAW,GAAgB,IAAI,mBAAW,EAAE,CAAC;IACnD,iBAAiB;IACjB,MAAM,OAAO,GAAqC,MAAM,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACpH,OAAO,OAAO,IAAI,EAAE,CAAC;AACvB,CAAC"}
|