mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 18:26:00 +00:00
runner openreader - support for plugins
This commit is contained in:
24
packages/tools/src/packageTools.ts
Normal file
24
packages/tools/src/packageTools.ts
Normal 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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user