runner openreader - support for plugins

This commit is contained in:
Jan Prochazka
2020-11-22 09:03:16 +01:00
parent 286cac066c
commit 7d1c0c5c18
5 changed files with 42 additions and 21 deletions

View File

@@ -0,0 +1,24 @@
import _ from 'lodash';
export function extractShellApiPlugins(functionName, props): string[] {
const res = [];
const nsMatch = functionName.match(/^([^@]+)@([^@]+)/);
if (nsMatch) {
res.push(nsMatch[2]);
}
if (props && props.connection && props.connection.engine) {
const nsMatchEngine = props.connection.engine.match(/^([^@]+)@([^@]+)/);
if (nsMatchEngine) {
res.push(nsMatchEngine[2]);
}
}
return res;
}
export function extractShellApiFunctionName(functionName) {
const nsMatch = functionName.match(/^([^@]+)@([^@]+)/);
if (nsMatch) {
return `${_.camelCase(nsMatch[2])}.shellApi.${nsMatch[1]}`;
}
return `dbgateApi.${functionName}`;
}