@things-factory/integration-base 6.1.117 → 6.1.118
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.
@@ -1,28 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const vm2_1 = require("vm2");
|
4
|
-
const utils_1 = require("@things-factory/utils");
|
5
4
|
const connection_manager_1 = require("../connection-manager");
|
6
5
|
const task_registry_1 = require("../task-registry");
|
7
|
-
const oracledb = require('oracledb');
|
8
|
-
const TYPES = {
|
9
|
-
Number: oracledb.NUMBER,
|
10
|
-
String: oracledb.STRING,
|
11
|
-
Date: oracledb.DATE,
|
12
|
-
Buffer: oracledb.BUFFER,
|
13
|
-
Blob: oracledb.BLOB,
|
14
|
-
Clob: oracledb.CLOB,
|
15
|
-
Cursor: oracledb.CURSOR
|
16
|
-
};
|
17
|
-
const DIR = {
|
18
|
-
In: oracledb.BIND_IN,
|
19
|
-
Inout: oracledb.BIND_INOUT,
|
20
|
-
Out: oracledb.BIND_OUT
|
21
|
-
};
|
22
6
|
async function DatabaseExecute(step, context) {
|
23
7
|
var { domain, data, variables } = context;
|
24
|
-
var { connection: connectionName, params } = step;
|
25
|
-
var { procedure, parameters } = params;
|
8
|
+
var { connection: connectionName, params: { procedure, params } } = step;
|
26
9
|
var dbconnection = connection_manager_1.ConnectionManager.getConnectionInstanceByName(domain, connectionName);
|
27
10
|
const vm = new vm2_1.VM({
|
28
11
|
sandbox: {
|
@@ -33,17 +16,7 @@ async function DatabaseExecute(step, context) {
|
|
33
16
|
});
|
34
17
|
procedure = vm.run('`' + procedure + '`');
|
35
18
|
console.log('procedure: ', procedure);
|
36
|
-
|
37
|
-
parameters.reduce((sum, { name, val, dir, type, maxSize }) => {
|
38
|
-
sum[name] = {
|
39
|
-
dir: DIR[dir],
|
40
|
-
type: TYPES[type],
|
41
|
-
val: (0, utils_1.access)(val),
|
42
|
-
maxSize
|
43
|
-
};
|
44
|
-
return sum;
|
45
|
-
}, {});
|
46
|
-
var procedureResult = await dbconnection.executeProcedure(procedure, procedureParameters);
|
19
|
+
var procedureResult = await dbconnection.executeProcedure(procedure);
|
47
20
|
console.log('procedureResult: ', procedureResult);
|
48
21
|
return {
|
49
22
|
data: procedureResult
|
@@ -56,9 +29,9 @@ DatabaseExecute.parameterSpec = [
|
|
56
29
|
label: 'procedure'
|
57
30
|
},
|
58
31
|
{
|
59
|
-
type: '
|
60
|
-
name: '
|
61
|
-
label: '
|
32
|
+
type: 'textarea',
|
33
|
+
name: 'params',
|
34
|
+
label: 'params'
|
62
35
|
}
|
63
36
|
];
|
64
37
|
task_registry_1.TaskRegistry.registerTaskHandler('database-procedure', DatabaseExecute);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"database-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/database-procedure.ts"],"names":[],"mappings":";;AAAA,6BAAwB;AACxB,
|
1
|
+
{"version":3,"file":"database-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/database-procedure.ts"],"names":[],"mappings":";;AAAA,6BAAwB;AACxB,8DAAyD;AACzD,oDAA+C;AAE/C,KAAK,UAAU,eAAe,CAAC,IAAI,EAAE,OAAO;IAC1C,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IACzC,IAAI,EACF,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAC9B,GAAG,IAAI,CAAA;IAER,IAAI,YAAY,GAAG,sCAAiB,CAAC,2BAA2B,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;IAExF,MAAM,EAAE,GAAG,IAAI,QAAE,CAAC;QAChB,OAAO,EAAE;YACP,MAAM;YACN,IAAI;YACJ,SAAS;SACV;KACF,CAAC,CAAA;IAEF,SAAS,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,SAAS,GAAG,GAAG,CAAC,CAAA;IAEzC,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,CAAA;IAErC,IAAI,eAAe,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAA;IAEpE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAA;IAEjD,OAAO;QACL,IAAI,EAAE,eAAe;KACtB,CAAA;AACH,CAAC;AAED,eAAe,CAAC,aAAa,GAAG;IAC9B;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;KACnB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;KAChB;CACF,CAAA;AAED,4BAAY,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["import { VM } from 'vm2'\nimport { ConnectionManager } from '../connection-manager'\nimport { TaskRegistry } from '../task-registry'\n\nasync function DatabaseExecute(step, context) {\n var { domain, data, variables } = context\n var {\n connection: connectionName,\n params: { procedure, params }\n } = step\n\n var dbconnection = ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n\n const vm = new VM({\n sandbox: {\n domain,\n data,\n variables\n }\n })\n\n procedure = vm.run('`' + procedure + '`')\n\n console.log('procedure: ', procedure)\n\n var procedureResult = await dbconnection.executeProcedure(procedure)\n\n console.log('procedureResult: ', procedureResult)\n\n return {\n data: procedureResult\n }\n}\n\nDatabaseExecute.parameterSpec = [\n {\n type: 'textarea',\n name: 'procedure',\n label: 'procedure'\n },\n {\n type: 'textarea',\n name: 'params',\n label: 'params'\n }\n]\n\nTaskRegistry.registerTaskHandler('database-procedure', DatabaseExecute)\n"]}
|