@things-factory/integration-base 6.1.164 → 6.1.171
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/integration-base",
|
3
|
-
"version": "6.1.
|
3
|
+
"version": "6.1.171",
|
4
4
|
"main": "dist-server/index.js",
|
5
5
|
"browser": "client/index.js",
|
6
6
|
"things-factory": true,
|
@@ -26,12 +26,12 @@
|
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
28
|
"@apollo/client": "^3.6.9",
|
29
|
-
"@things-factory/api": "^6.1.
|
30
|
-
"@things-factory/auth-base": "^6.1.
|
31
|
-
"@things-factory/env": "^6.1.
|
32
|
-
"@things-factory/oauth2-client": "^6.1.
|
33
|
-
"@things-factory/scheduler-client": "^6.1.
|
34
|
-
"@things-factory/shell": "^6.1.
|
29
|
+
"@things-factory/api": "^6.1.171",
|
30
|
+
"@things-factory/auth-base": "^6.1.171",
|
31
|
+
"@things-factory/env": "^6.1.166",
|
32
|
+
"@things-factory/oauth2-client": "^6.1.171",
|
33
|
+
"@things-factory/scheduler-client": "^6.1.171",
|
34
|
+
"@things-factory/shell": "^6.1.166",
|
35
35
|
"async-mqtt": "^2.5.0",
|
36
36
|
"chance": "^1.1.11",
|
37
37
|
"cross-fetch": "^3.0.4",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"devDependencies": {
|
47
47
|
"@types/cron": "^2.0.1"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "865a487a7e01d5d1b0479c5543d68319c73853da"
|
50
50
|
}
|
@@ -1,65 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const vm2_1 = require("vm2");
|
4
|
-
const utils_1 = require("@things-factory/utils");
|
5
|
-
const connection_manager_1 = require("../connection-manager");
|
6
|
-
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
|
-
async function DatabaseExecute(step, context) {
|
23
|
-
var { domain, data, variables } = context;
|
24
|
-
var { connection: connectionName, params } = step;
|
25
|
-
var { procedure, parameters } = params;
|
26
|
-
var dbconnection = connection_manager_1.ConnectionManager.getConnectionInstanceByName(domain, connectionName);
|
27
|
-
const vm = new vm2_1.VM({
|
28
|
-
sandbox: {
|
29
|
-
domain,
|
30
|
-
data,
|
31
|
-
variables
|
32
|
-
}
|
33
|
-
});
|
34
|
-
procedure = vm.run('`' + procedure + '`');
|
35
|
-
console.log('procedure: ', procedure);
|
36
|
-
const procedureParameters = parameters &&
|
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);
|
47
|
-
console.log('procedureResult: ', procedureResult);
|
48
|
-
return {
|
49
|
-
data: procedureResult
|
50
|
-
};
|
51
|
-
}
|
52
|
-
DatabaseExecute.parameterSpec = [
|
53
|
-
{
|
54
|
-
type: 'textarea',
|
55
|
-
name: 'procedure',
|
56
|
-
label: 'procedure'
|
57
|
-
},
|
58
|
-
{
|
59
|
-
type: 'procedure-parameters',
|
60
|
-
name: 'parameters',
|
61
|
-
label: 'parameters'
|
62
|
-
}
|
63
|
-
];
|
64
|
-
task_registry_1.TaskRegistry.registerTaskHandler('database-procedure', DatabaseExecute);
|
65
|
-
//# sourceMappingURL=database-procedure.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"database-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/database-procedure.ts"],"names":[],"mappings":";;AAAA,6BAAwB;AACxB,iDAA8C;AAC9C,8DAAyD;AACzD,oDAA+C;AAE/C,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAIpC,MAAM,KAAK,GAAG;IACZ,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;CACxB,CAAA;AAED,MAAM,GAAG,GAAG;IACV,EAAE,EAAE,QAAQ,CAAC,OAAO;IACpB,KAAK,EAAE,QAAQ,CAAC,UAAU;IAC1B,GAAG,EAAE,QAAQ,CAAC,QAAQ;CACvB,CAAA;AAED,KAAK,UAAU,eAAe,CAAC,IAAI,EAAE,OAAO;IAC1C,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IACzC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAEjD,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,MAAqE,CAAA;IAErG,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,MAAM,mBAAmB,GACvB,UAAU;QACV,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;YAC3D,GAAG,CAAC,IAAI,CAAC,GAAG;gBACV,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;gBACb,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;gBACjB,GAAG,EAAE,IAAA,cAAM,EAAC,GAAG,CAAC;gBAChB,OAAO;aACR,CAAA;YAED,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAE,CAAC,CAAA;IAER,IAAI,eAAe,GAAG,MAAM,YAAY,CAAC,gBAAgB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;IAEzF,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,sBAAsB;QAC5B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;KACpB;CACF,CAAA;AAED,4BAAY,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["import { VM } from 'vm2'\nimport { access } from '@things-factory/utils'\nimport { ConnectionManager } from '../connection-manager'\nimport { TaskRegistry } from '../task-registry'\n\nconst oracledb = require('oracledb')\n\ntype ProcedureParameterType = { name: string; dir: string; type: string; val: any; maxSize: number }\n\nconst TYPES = {\n Number: oracledb.NUMBER,\n String: oracledb.STRING,\n Date: oracledb.DATE,\n Buffer: oracledb.BUFFER,\n Blob: oracledb.BLOB,\n Clob: oracledb.CLOB,\n Cursor: oracledb.CURSOR\n}\n\nconst DIR = {\n In: oracledb.BIND_IN,\n Inout: oracledb.BIND_INOUT,\n Out: oracledb.BIND_OUT\n}\n\nasync function DatabaseExecute(step, context) {\n var { domain, data, variables } = context\n var { connection: connectionName, params } = step\n\n var { procedure, parameters } = params as { procedure: string; parameters: ProcedureParameterType[] }\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 const procedureParameters =\n parameters &&\n parameters.reduce((sum, { name, val, dir, type, maxSize }) => {\n sum[name] = {\n dir: DIR[dir],\n type: TYPES[type],\n val: access(val), // TODO change by type\n maxSize\n }\n\n return sum\n }, {})\n\n var procedureResult = await dbconnection.executeProcedure(procedure, procedureParameters)\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: 'procedure-parameters',\n name: 'parameters',\n label: 'parameters'\n }\n]\n\nTaskRegistry.registerTaskHandler('database-procedure', DatabaseExecute)\n"]}
|