@things-factory/integration-base 9.1.19 → 10.0.0-beta.2

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.
Files changed (55) hide show
  1. package/dist-server/engine/connector/graphql-connector.js +1 -3
  2. package/dist-server/engine/connector/graphql-connector.js.map +1 -1
  3. package/dist-server/engine/connector/headless-connector.js +9 -1
  4. package/dist-server/engine/connector/headless-connector.js.map +1 -1
  5. package/dist-server/engine/connector/operato-connector.js +1 -3
  6. package/dist-server/engine/connector/operato-connector.js.map +1 -1
  7. package/dist-server/engine/evaluate-template.d.ts +21 -0
  8. package/dist-server/engine/evaluate-template.js +36 -0
  9. package/dist-server/engine/evaluate-template.js.map +1 -0
  10. package/dist-server/engine/index.d.ts +1 -0
  11. package/dist-server/engine/index.js +1 -0
  12. package/dist-server/engine/index.js.map +1 -1
  13. package/dist-server/engine/task/database-query.d.ts +1 -1
  14. package/dist-server/engine/task/database-query.js +2 -10
  15. package/dist-server/engine/task/database-query.js.map +1 -1
  16. package/dist-server/engine/task/graphql-mutate.d.ts +1 -1
  17. package/dist-server/engine/task/graphql-mutate.js +2 -10
  18. package/dist-server/engine/task/graphql-mutate.js.map +1 -1
  19. package/dist-server/engine/task/graphql-query.d.ts +1 -1
  20. package/dist-server/engine/task/graphql-query.js +2 -10
  21. package/dist-server/engine/task/graphql-query.js.map +1 -1
  22. package/dist-server/engine/task/headless-scrap.js +9 -1
  23. package/dist-server/engine/task/headless-scrap.js.map +1 -1
  24. package/dist-server/engine/task/http-get.d.ts +1 -1
  25. package/dist-server/engine/task/http-get.js +5 -14
  26. package/dist-server/engine/task/http-get.js.map +1 -1
  27. package/dist-server/engine/task/http-post.d.ts +1 -1
  28. package/dist-server/engine/task/http-post.js +4 -13
  29. package/dist-server/engine/task/http-post.js.map +1 -1
  30. package/dist-server/engine/task/local-graphql-mutate.d.ts +1 -1
  31. package/dist-server/engine/task/local-graphql-mutate.js +2 -10
  32. package/dist-server/engine/task/local-graphql-mutate.js.map +1 -1
  33. package/dist-server/engine/task/local-graphql-query.d.ts +1 -1
  34. package/dist-server/engine/task/local-graphql-query.js +2 -10
  35. package/dist-server/engine/task/local-graphql-query.js.map +1 -1
  36. package/dist-server/engine/task/log.d.ts +1 -1
  37. package/dist-server/engine/task/log.js +2 -10
  38. package/dist-server/engine/task/log.js.map +1 -1
  39. package/dist-server/engine/task/mssql-exec-query.d.ts +0 -1
  40. package/dist-server/engine/task/mssql-exec-query.js +2 -3
  41. package/dist-server/engine/task/mssql-exec-query.js.map +1 -1
  42. package/dist-server/engine/task/mssql-procedure.d.ts +1 -1
  43. package/dist-server/engine/task/mssql-procedure.js +2 -12
  44. package/dist-server/engine/task/mssql-procedure.js.map +1 -1
  45. package/dist-server/engine/task/oracle-procedure.d.ts +1 -1
  46. package/dist-server/engine/task/oracle-procedure.js +2 -12
  47. package/dist-server/engine/task/oracle-procedure.js.map +1 -1
  48. package/dist-server/engine/task/script.d.ts +1 -1
  49. package/dist-server/engine/task/script.js +18 -19
  50. package/dist-server/engine/task/script.js.map +1 -1
  51. package/dist-server/service/index.d.ts +1 -1
  52. package/dist-server/service/scenario-instance/index.d.ts +1 -1
  53. package/dist-server/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +13 -14
  55. /package/client/{index.js → index.ts} +0 -0
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const env_1 = require("@things-factory/env");
4
4
  const utils_1 = require("@things-factory/utils");
5
5
  const connection_manager_1 = require("../connection-manager");
6
+ const evaluate_template_1 = require("../evaluate-template");
6
7
  const task_registry_1 = require("../task-registry");
7
- require("ses");
8
8
  try {
9
9
  var mssql = require('mssql');
10
10
  }
@@ -38,22 +38,12 @@ async function MssqlProcedure(step, context) {
38
38
  if (!code) {
39
39
  throw 'procedure code not defined';
40
40
  }
41
- const compartment = new Compartment({
42
- domain,
43
- user,
44
- lng,
45
- data,
46
- variables,
47
- console
48
- });
49
- let evalCode;
50
41
  try {
51
- evalCode = compartment.evaluate('`' + code + '`');
42
+ code = (0, evaluate_template_1.evaluateTemplate)(code, { domain, user, lng, data, variables, console });
52
43
  }
53
44
  catch (err) {
54
45
  throw new Error(`Failed to evaluate code: ${err.message}`);
55
46
  }
56
- code = evalCode;
57
47
  const procedureParameters = parameters &&
58
48
  parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {
59
49
  sum[name] = {
@@ -1 +1 @@
1
- {"version":3,"file":"mssql-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/mssql-procedure.ts"],"names":[],"mappings":";;AAAA,6CAA4C;AAC5C,iDAA8C;AAC9C,8DAAyD;AACzD,oDAA+C;AAG/C,eAAY;AAEZ,IAAI,CAAC;IACH,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,YAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAA;AAClD,CAAC;AAiBD,MAAM,GAAG,GAAG;IACV,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO,CAAC,sBAAsB;CACtC,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,UAAU;IACV,KAAK;IACL,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,YAAY;CACb,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,CAAC,CAAA;AAC7E,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAElF,KAAK,UAAU,cAAc,CAAC,IAAe,EAAE,OAAgB;IAC7D,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,OAAO,CAAA;IACpD,I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AC,IAAI,CAAC,CAAC,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;oBACzC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;oBACpB,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;wBACzB,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC;wBACtB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;YAC1B,CAAC;YAED,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC3E,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;gBACxC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,OAAO,CAAA;YAC7B,CAAC;YAED,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAE,CAAC,CAAA;IAER,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;IAEzE,OAAO;QACL,IAAI,EAAE,MAAM;KACb,CAAA;AACH,CAAC;AAED,cAAc,CAAC,aAAa,GAAG;IAC7B;QACE,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,MAAM,EAAE,OAAO;SAChB;KACF;CACF,CAAA;AAED,cAAc,CAAC,IAAI,GAAG,kCAAkC,CAAA;AAExD,4BAAY,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAA","sourcesContent":["import { logger } from '@things-factory/env'\nimport { access } from '@things-factory/utils'\nimport { ConnectionManager } from '../connection-manager'\nimport { TaskRegistry } from '../task-registry'\nimport { InputStep } from '../../service/step/step-type'\nimport { Context } from '../types'\nimport 'ses'\n\ntry {\n var mssql = require('mssql')\n} catch (err) {\n logger.error('mssql module loading failed', err)\n}\n\ntype ProcedureParameterType = {\n name: string\n dir: string\n type: string\n val?: any\n accessor?: string\n maxSize?: number\n}\n\ntype ValueType = {\n code?: string\n procedure?: string\n parameters?: ProcedureParameterType[]\n}\n\nconst DIR = {\n In: 'in',\n Out: 'out',\n Inout: 'inout' /* 초기값이 있는 out 파라미터 */\n}\n\nconst NUMBER_TYPES = [\n 'TINYINT',\n 'SMALLINT',\n 'INT',\n 'BIGINT',\n 'FLOAT',\n 'REAL',\n 'DECIMAL',\n 'NUMERIC',\n 'MONEY',\n 'SMALLMONEY'\n]\n\nconst DATE_TYPES = ['DATE', 'TIME', 'DATETIME', 'SMALLDATETIME', 'DATETIME2']\nconst PARAMETERIZED_STRINGS = ['NCHAR', 'NVARCHAR', 'NTEXT', 'DECIMAL', 'NUMERIC']\n\nasync function MssqlProcedure(step: InputStep, context: Context) {\n var { domain, user, data, variables, lng } = context\n var { connection: connectionName, params } = step\n\n var { code = '', procedure = '', parameters = [] } = params.parameters as ValueType\n\n var dbconnection = await ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n\n if (!code) {\n throw 'procedure code not defined'\n }\n\n const compartment = new Compartment({\n domain,\n user,\n lng,\n data,\n variables,\n console\n })\n\n let evalCode\n try {\n evalCode = compartment.evaluate('`' + code + '`')\n } catch (err) {\n throw new Error(`Failed to evaluate code: ${err.message}`)\n }\n\n code = evalCode\n\n const procedureParameters =\n parameters &&\n parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {\n sum[name] = {\n dir: DIR[dir],\n type\n }\n\n const calculated = accessor ? access(accessor, data) || val : val\n\n if (calculated !== undefined) {\n sum[name].val = NUMBER_TYPES.includes(type)\n ? Number(calculated)\n : DATE_TYPES.includes(type)\n ? new Date(calculated)\n : String(calculated)\n }\n\n if ((dir == DIR.In || dir == DIR.Inout) && maxSize > 0 && type == 'String') {\n sum[name].type = mssql?.VarChar(maxSize)\n sum[name].maxSize = maxSize\n }\n\n return sum\n }, {})\n\n const result = await dbconnection.execute(procedure, procedureParameters)\n\n return {\n data: result\n }\n}\n\nMssqlProcedure.parameterSpec = [\n {\n type: 'procedure-parameters',\n name: 'parameters',\n label: '',\n property: {\n dbtype: 'mssql'\n }\n }\n]\n\nMssqlProcedure.help = 'integration/task/mssql-procedure'\n\nTaskRegistry.registerTaskHandler('mssql-procedure', MssqlProcedure)\n"]}
1
+ {"version":3,"file":"mssql-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/mssql-procedure.ts"],"names":[],"mappings":";;AAAA,6CAA4C;AAC5C,iDAA8C;AAC9C,8DAAyD;AACzD,4DAAuD;AACvD,oDAA+C;AAI/C,IAAI,CAAC;IACH,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAC9B,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,YAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAA;AAClD,CAAC;AAiBD,MAAM,GAAG,GAAG;IACV,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO,CAAC,sBAAsB;CACtC,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,UAAU;IACV,KAAK;IACL,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;IACP,YAAY;CACb,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,CAAC,CAAA;AAC7E,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAElF,KAAK,UAAU,cAAc,CAAC,IAAe,EAAE,OAAgB;IAC7D,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,OAAO,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ACpB,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;wBACzB,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC;wBACtB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;YAC1B,CAAC;YAED,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,IAAI,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC3E,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;gBACxC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,OAAO,CAAA;YAC7B,CAAC;YAED,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAE,CAAC,CAAA;IAER,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;IAEzE,OAAO;QACL,IAAI,EAAE,MAAM;KACb,CAAA;AACH,CAAC;AAED,cAAc,CAAC,aAAa,GAAG;IAC7B;QACE,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,MAAM,EAAE,OAAO;SAChB;KACF;CACF,CAAA;AAED,cAAc,CAAC,IAAI,GAAG,kCAAkC,CAAA;AAExD,4BAAY,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAA","sourcesContent":["import { logger } from '@things-factory/env'\nimport { access } from '@things-factory/utils'\nimport { ConnectionManager } from '../connection-manager'\nimport { evaluateTemplate } from '../evaluate-template'\nimport { TaskRegistry } from '../task-registry'\nimport { InputStep } from '../../service/step/step-type'\nimport { Context } from '../types'\n\ntry {\n var mssql = require('mssql')\n} catch (err) {\n logger.error('mssql module loading failed', err)\n}\n\ntype ProcedureParameterType = {\n name: string\n dir: string\n type: string\n val?: any\n accessor?: string\n maxSize?: number\n}\n\ntype ValueType = {\n code?: string\n procedure?: string\n parameters?: ProcedureParameterType[]\n}\n\nconst DIR = {\n In: 'in',\n Out: 'out',\n Inout: 'inout' /* 초기값이 있는 out 파라미터 */\n}\n\nconst NUMBER_TYPES = [\n 'TINYINT',\n 'SMALLINT',\n 'INT',\n 'BIGINT',\n 'FLOAT',\n 'REAL',\n 'DECIMAL',\n 'NUMERIC',\n 'MONEY',\n 'SMALLMONEY'\n]\n\nconst DATE_TYPES = ['DATE', 'TIME', 'DATETIME', 'SMALLDATETIME', 'DATETIME2']\nconst PARAMETERIZED_STRINGS = ['NCHAR', 'NVARCHAR', 'NTEXT', 'DECIMAL', 'NUMERIC']\n\nasync function MssqlProcedure(step: InputStep, context: Context) {\n var { domain, user, data, variables, lng } = context\n var { connection: connectionName, params } = step\n\n var { code = '', procedure = '', parameters = [] } = params.parameters as ValueType\n\n var dbconnection = await ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n\n if (!code) {\n throw 'procedure code not defined'\n }\n\n try {\n code = evaluateTemplate(code, { domain, user, lng, data, variables, console })\n } catch (err) {\n throw new Error(`Failed to evaluate code: ${err.message}`)\n }\n\n const procedureParameters =\n parameters &&\n parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {\n sum[name] = {\n dir: DIR[dir],\n type\n }\n\n const calculated = accessor ? access(accessor, data) || val : val\n\n if (calculated !== undefined) {\n sum[name].val = NUMBER_TYPES.includes(type)\n ? Number(calculated)\n : DATE_TYPES.includes(type)\n ? new Date(calculated)\n : String(calculated)\n }\n\n if ((dir == DIR.In || dir == DIR.Inout) && maxSize > 0 && type == 'String') {\n sum[name].type = mssql?.VarChar(maxSize)\n sum[name].maxSize = maxSize\n }\n\n return sum\n }, {})\n\n const result = await dbconnection.execute(procedure, procedureParameters)\n\n return {\n data: result\n }\n}\n\nMssqlProcedure.parameterSpec = [\n {\n type: 'procedure-parameters',\n name: 'parameters',\n label: '',\n property: {\n dbtype: 'mssql'\n }\n }\n]\n\nMssqlProcedure.help = 'integration/task/mssql-procedure'\n\nTaskRegistry.registerTaskHandler('mssql-procedure', MssqlProcedure)\n"]}
@@ -1 +1 @@
1
- import 'ses';
1
+ export {};
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const env_1 = require("@things-factory/env");
4
4
  const utils_1 = require("@things-factory/utils");
5
5
  const connection_manager_1 = require("../connection-manager");
6
+ const evaluate_template_1 = require("../evaluate-template");
6
7
  const task_registry_1 = require("../task-registry");
7
- require("ses");
8
8
  try {
9
9
  var oracledb = require('oracledb');
10
10
  }
@@ -33,22 +33,12 @@ async function OracleProcedure(step, context) {
33
33
  if (!code) {
34
34
  throw 'procedure code not defined';
35
35
  }
36
- const compartment = new Compartment({
37
- domain,
38
- user,
39
- lng,
40
- data,
41
- variables,
42
- console
43
- });
44
- let evalCode;
45
36
  try {
46
- evalCode = compartment.evaluate('`' + code + '`');
37
+ code = (0, evaluate_template_1.evaluateTemplate)(code, { domain, user, lng, data, variables, console });
47
38
  }
48
39
  catch (err) {
49
40
  throw new Error(`Failed to evaluate code: ${err.message}`);
50
41
  }
51
- code = evalCode;
52
42
  const procedureParameters = parameters &&
53
43
  parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {
54
44
  sum[name] = {
@@ -1 +1 @@
1
- {"version":3,"file":"oracle-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/oracle-procedure.ts"],"names":[],"mappings":";;AAAA,6CAA4C;AAC5C,iDAA8C;AAC9C,8DAAyD;AACzD,oDAA+C;AAG/C,eAAY;AAEZ,IAAI,CAAC;IACH,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,YAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAA;AACrD,CAAC;AAiBD,MAAM,KAAK,GAAG;IACZ,MAAM,EAAE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AAsB;QAC5B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,MAAM,EAAE,QAAQ;SACjB;KACF;CACF,CAAA;AAED,eAAe,CAAC,IAAI,GAAG,mCAAmC,CAAA;AAE1D,4BAAY,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["import { logger } from '@things-factory/env'\nimport { access } from '@things-factory/utils'\nimport { ConnectionManager } from '../connection-manager'\nimport { TaskRegistry } from '../task-registry'\nimport { InputStep } from '../../service/step/step-type'\nimport { Context } from '../types'\nimport 'ses'\n\ntry {\n var oracledb = require('oracledb')\n} catch (err) {\n logger.error('oracledb module loading failed', err)\n}\n\ntype ProcedureParameterType = {\n name: string\n dir: string\n type: string\n val?: any\n accessor?: string\n maxSize?: number\n}\n\ntype ValueType = {\n code?: string\n procedure?: string\n parameters?: ProcedureParameterType[]\n}\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 OracleProcedure(step: InputStep, context: Context) {\n var { domain, user, data, variables, lng } = context\n var { connection: connectionName, params } = step\n\n var { code = '', parameters = [] } = params.parameters as ValueType\n\n var dbconnection = await ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n\n if (!code) {\n throw 'procedure code not defined'\n }\n\n const compartment = new Compartment({\n domain,\n user,\n lng,\n data,\n variables,\n console\n })\n\n let evalCode\n try {\n evalCode = compartment.evaluate('`' + code + '`')\n } catch (err) {\n throw new Error(`Failed to evaluate code: ${err.message}`)\n }\n\n code = evalCode\n\n const procedureParameters =\n parameters &&\n parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {\n sum[name] = {\n dir: DIR[dir],\n type: TYPES[type]\n }\n\n const calculated = accessor ? access(accessor, data) || val : val\n\n if (calculated !== undefined) {\n sum[name].val =\n type === 'Date'\n ? new Date(calculated)\n : type == 'Number'\n ? Number(calculated)\n : type == 'String'\n ? String(calculated)\n : calculated\n }\n\n if (maxSize) {\n sum[name].maxSize = maxSize\n }\n\n return sum\n }, {})\n\n const result = await dbconnection.execute(code, procedureParameters)\n\n return {\n data: result\n }\n}\n\nOracleProcedure.parameterSpec = [\n {\n type: 'procedure-parameters',\n name: 'parameters',\n label: '',\n property: {\n dbtype: 'oracle'\n }\n }\n]\n\nOracleProcedure.help = 'integration/task/oracle-procedure'\n\nTaskRegistry.registerTaskHandler('oracle-procedure', OracleProcedure)\n"]}
1
+ {"version":3,"file":"oracle-procedure.js","sourceRoot":"","sources":["../../../server/engine/task/oracle-procedure.ts"],"names":[],"mappings":";;AAAA,6CAA4C;AAC5C,iDAA8C;AAC9C,8DAAyD;AACzD,4DAAuD;AACvD,oDAA+C;AAI/C,IAAI,CAAC;IACH,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACpC,CAAC;AAAC,OAAO,GAAG,EAAE,CAAC;IACb,YAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAA;AACrD,CAAC;AAiBD,MAAM,KAAK,GAAG;IACZ,MAAM,EAAE,QAAQ,EAAE,MAAM;IACxB,MAAM,EAAE,QAAQ,EAAE,MAAM;IACxB,IAAI,EAAE,QAAQ,EAAE,IAAI;IACpB,MAAM,EAAE,QAAQ,EAAE,MAAM;IACxB,IAAI,EAAE,QAAQ,EAAE,IAAI;IACpB,IAAI,EAAE,QAAQ,EAAE,IAAI;IACpB,MAAM,EAAE,QAAQ,EAAE,MAAM;CACzB,CAAA;AAED,MAAM,GAAG,GAAG;IACV,EAAE,EAAE,QAAQ,EAAE,OAAO;IACrB,KAAK,EAAE,QAAQ,EAAE,UAAU;IAC3B,GAAG,EA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CAAA;YAEjE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG;oBACX,IAAI,KAAK,MAAM;wBACb,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC;wBACtB,CAAC,CAAC,IAAI,IAAI,QAAQ;4BAChB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;4BACpB,CAAC,CAAC,IAAI,IAAI,QAAQ;gCAChB,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;gCACpB,CAAC,CAAC,UAAU,CAAA;YACtB,CAAC;YAED,IAAI,OAAO,EAAE,CAAC;gBACZ,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,OAAO,CAAA;YAC7B,CAAC;YAED,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAE,CAAC,CAAA;IAER,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;IAEpE,OAAO;QACL,IAAI,EAAE,MAAM;KACb,CAAA;AACH,CAAC;AAED,eAAe,CAAC,aAAa,GAAG;IAC9B;QACE,IAAI,EAAE,sBAAsB;QAC5B,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,MAAM,EAAE,QAAQ;SACjB;KACF;CACF,CAAA;AAED,eAAe,CAAC,IAAI,GAAG,mCAAmC,CAAA;AAE1D,4BAAY,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAA","sourcesContent":["import { logger } from '@things-factory/env'\nimport { access } from '@things-factory/utils'\nimport { ConnectionManager } from '../connection-manager'\nimport { evaluateTemplate } from '../evaluate-template'\nimport { TaskRegistry } from '../task-registry'\nimport { InputStep } from '../../service/step/step-type'\nimport { Context } from '../types'\n\ntry {\n var oracledb = require('oracledb')\n} catch (err) {\n logger.error('oracledb module loading failed', err)\n}\n\ntype ProcedureParameterType = {\n name: string\n dir: string\n type: string\n val?: any\n accessor?: string\n maxSize?: number\n}\n\ntype ValueType = {\n code?: string\n procedure?: string\n parameters?: ProcedureParameterType[]\n}\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 OracleProcedure(step: InputStep, context: Context) {\n var { domain, user, data, variables, lng } = context\n var { connection: connectionName, params } = step\n\n var { code = '', parameters = [] } = params.parameters as ValueType\n\n var dbconnection = await ConnectionManager.getConnectionInstanceByName(domain, connectionName)\n\n if (!code) {\n throw 'procedure code not defined'\n }\n\n try {\n code = evaluateTemplate(code, { domain, user, lng, data, variables, console })\n } catch (err) {\n throw new Error(`Failed to evaluate code: ${err.message}`)\n }\n\n const procedureParameters =\n parameters &&\n parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {\n sum[name] = {\n dir: DIR[dir],\n type: TYPES[type]\n }\n\n const calculated = accessor ? access(accessor, data) || val : val\n\n if (calculated !== undefined) {\n sum[name].val =\n type === 'Date'\n ? new Date(calculated)\n : type == 'Number'\n ? Number(calculated)\n : type == 'String'\n ? String(calculated)\n : calculated\n }\n\n if (maxSize) {\n sum[name].maxSize = maxSize\n }\n\n return sum\n }, {})\n\n const result = await dbconnection.execute(code, procedureParameters)\n\n return {\n data: result\n }\n}\n\nOracleProcedure.parameterSpec = [\n {\n type: 'procedure-parameters',\n name: 'parameters',\n label: '',\n property: {\n dbtype: 'oracle'\n }\n }\n]\n\nOracleProcedure.help = 'integration/task/oracle-procedure'\n\nTaskRegistry.registerTaskHandler('oracle-procedure', OracleProcedure)\n"]}
@@ -1 +1 @@
1
- import 'ses';
1
+ export {};
@@ -1,34 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const task_registry_1 = require("../task-registry");
4
- require("ses");
4
+ const evaluate_template_1 = require("../evaluate-template");
5
5
  async function Script(step, context) {
6
6
  const { params: { script } } = step;
7
7
  const { domain, user, data, variables, lng, logger } = context;
8
- const compartment = new Compartment({
9
- domain,
10
- user,
11
- data,
12
- variables,
13
- logger,
14
- lng,
15
- console,
16
- Math,
17
- JSON,
18
- Date,
19
- setTimeout,
20
- setInterval,
21
- clearTimeout,
22
- clearInterval
23
- });
24
8
  const scriptSource = `
25
- (async () => {
9
+ return (async () => {
26
10
  ${script}
27
11
  })();
28
12
  `;
29
13
  try {
30
14
  return {
31
- data: await compartment.evaluate(scriptSource)
15
+ data: await (0, evaluate_template_1.evaluateScript)(scriptSource, {
16
+ domain,
17
+ user,
18
+ data,
19
+ variables,
20
+ logger,
21
+ lng,
22
+ console,
23
+ Math,
24
+ JSON,
25
+ Date,
26
+ setTimeout,
27
+ setInterval,
28
+ clearTimeout,
29
+ clearInterval
30
+ })
32
31
  };
33
32
  }
34
33
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"script.js","sourceRoot":"","sources":["../../../server/engine/task/script.ts"],"names":[],"mappings":";;AAAA,oDAA+C;AAG/C,eAAY;AAEZ,KAAK,UAAU,MAAM,CAAC,IAAe,EAAE,OAAgB;IACrD,MAAM,EACJ,MAAM,EAAE,EAAE,MAAM,EAAE,EACnB,GAAG,IAAI,CAAA;IAER,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAE9D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;QAClC,MAAM;QACN,IAAI;QACJ,IAAI;QACJ,SAAS;QACT,MAAM;QACN,GAAG;QACH,OAAO;QACP,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,UAAU;QACV,WAAW;QACX,YAAY;QACZ,aAAa;KACd,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG;;QAEf,MAAM;;GAEX,CAAA;IAED,IAAI,CAAC;QACH,OAAO;YACL,IAAI,EAAE,MAAM,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC;SAC/C,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,CAAC,aAAa,GAAG;IACrB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE;YACR,QAAQ,EAAE,YAAY;YACtB,eAAe,EAAE,IAAI;SACtB;QACD,MAAM,EAAE;YACN,IAAI,EAAE,GAAG;SACV;KACF;CACF,CAAA;AAED,MAAM,CAAC,aAAa,GAAG,IAAI,CAAA;AAC3B,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;AAEvC,4BAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import { TaskRegistry } from '../task-registry'\nimport { InputStep } from '../../service/step/step-type'\nimport { Context } from '../types'\nimport 'ses'\n\nasync function Script(step: InputStep, context: Context) {\n const {\n params: { script }\n } = step\n\n const { domain, user, data, variables, lng, logger } = context\n\n const compartment = new Compartment({\n domain,\n user,\n data,\n variables,\n logger,\n lng,\n console,\n Math,\n JSON,\n Date,\n setTimeout,\n setInterval,\n clearTimeout,\n clearInterval\n })\n\n const scriptSource = `\n (async () => {\n ${script}\n })();\n `\n\n try {\n return {\n data: await compartment.evaluate(scriptSource)\n }\n } catch (err) {\n throw new Error(`Script execution failed: ${err.message}`)\n }\n}\n\nScript.parameterSpec = [\n {\n type: 'textarea',\n name: 'script',\n label: 'script',\n property: {\n language: 'javascript',\n showLineNumbers: true\n },\n styles: {\n flex: '1'\n }\n }\n]\n\nScript.connectorFree = true\nScript.help = 'integration/task/script'\n\nTaskRegistry.registerTaskHandler('script', Script)\n"]}
1
+ {"version":3,"file":"script.js","sourceRoot":"","sources":["../../../server/engine/task/script.ts"],"names":[],"mappings":";;AAAA,oDAA+C;AAC/C,4DAAqD;AAIrD,KAAK,UAAU,MAAM,CAAC,IAAe,EAAE,OAAgB;IACrD,MAAM,EACJ,MAAM,EAAE,EAAE,MAAM,EAAE,EACnB,GAAG,IAAI,CAAA;IAER,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAE9D,MAAM,YAAY,GAAG;;QAEf,MAAM;;GAEX,CAAA;IAED,IAAI,CAAC;QACH,OAAO;YACL,IAAI,EAAE,MAAM,IAAA,kCAAc,EAAC,YAAY,EAAE;gBACvC,MAAM;gBACN,IAAI;gBACJ,IAAI;gBACJ,SAAS;gBACT,MAAM;gBACN,GAAG;gBACH,OAAO;gBACP,IAAI;gBACJ,IAAI;gBACJ,IAAI;gBACJ,UAAU;gBACV,WAAW;gBACX,YAAY;gBACZ,aAAa;aACd,CAAC;SACH,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;IAC5D,CAAC;AACH,CAAC;AAED,MAAM,CAAC,aAAa,GAAG;IACrB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE;YACR,QAAQ,EAAE,YAAY;YACtB,eAAe,EAAE,IAAI;SACtB;QACD,MAAM,EAAE;YACN,IAAI,EAAE,GAAG;SACV;KACF;CACF,CAAA;AAED,MAAM,CAAC,aAAa,GAAG,IAAI,CAAA;AAC3B,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;AAEvC,4BAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import { TaskRegistry } from '../task-registry'\nimport { evaluateScript } from '../evaluate-template'\nimport { InputStep } from '../../service/step/step-type'\nimport { Context } from '../types'\n\nasync function Script(step: InputStep, context: Context) {\n const {\n params: { script }\n } = step\n\n const { domain, user, data, variables, lng, logger } = context\n\n const scriptSource = `\n return (async () => {\n ${script}\n })();\n `\n\n try {\n return {\n data: await evaluateScript(scriptSource, {\n domain,\n user,\n data,\n variables,\n logger,\n lng,\n console,\n Math,\n JSON,\n Date,\n setTimeout,\n setInterval,\n clearTimeout,\n clearInterval\n })\n }\n } catch (err) {\n throw new Error(`Script execution failed: ${err.message}`)\n }\n}\n\nScript.parameterSpec = [\n {\n type: 'textarea',\n name: 'script',\n label: 'script',\n property: {\n language: 'javascript',\n showLineNumbers: true\n },\n styles: {\n flex: '1'\n }\n }\n]\n\nScript.connectorFree = true\nScript.help = 'integration/task/script'\n\nTaskRegistry.registerTaskHandler('script', Script)\n"]}
@@ -12,7 +12,7 @@ export * from './payload-log/payload-log';
12
12
  export * from './state-register/state-register';
13
13
  export declare const entities: any[];
14
14
  export declare const schema: {
15
- resolverClasses: (typeof import("./connection/connection-query").ConnectionQuery | typeof import("./connection/connection-mutation").ConnectionMutation | typeof import("./connection/connection-subscription").ConnectionSubscription | typeof import("./connector/connector-query").ConnectorQuery | typeof import("./scenario/scenario-query").ScenarioQuery | typeof import("./scenario/scenario-mutation").ScenarioMutation | typeof import("./scenario-instance/scenario-instance-query").ScenarioInstanceQuery | typeof import("./scenario-instance/scenario-instance-mutation").ScenarioInstanceMutation | typeof import("./scenario-instance/scenario-instance-subscription").ScenarioInstanceSubscription | typeof import("./scenario-queue/scenario-queue-subscription").ScenarioQueueSubscription | typeof import("./step/step-query").StepQuery | typeof import("./step/step-mutation").StepMutation | typeof import("./task-type/task-type-query").TaskTypeQuery | typeof import("./payload-log/payload-log-query").PayloadLogQuery | typeof import("./payload-log/payload-log-mutation").PayloadLogMutation | typeof import("./state-register/state-register-query").StateRegisterQuery | typeof import("./state-register/state-register-mutation").StateRegisterMutation | typeof import("./state-register/data-resolver").DataResolver | typeof import("./analysis/analysis-query").IntegrationAnalysisQuery)[];
15
+ resolverClasses: (typeof import("./scenario-queue/scenario-queue-subscription").ScenarioQueueSubscription | typeof import("./scenario-instance/scenario-instance-subscription").ScenarioInstanceSubscription | typeof import("./scenario-instance/scenario-instance-query").ScenarioInstanceQuery | typeof import("./scenario/scenario-query").ScenarioQuery | typeof import("./connection/connection-query").ConnectionQuery | typeof import("./connection/connection-mutation").ConnectionMutation | typeof import("./connection/connection-subscription").ConnectionSubscription | typeof import("./connector/connector-query").ConnectorQuery | typeof import("./scenario/scenario-mutation").ScenarioMutation | typeof import("./scenario-instance/scenario-instance-mutation").ScenarioInstanceMutation | typeof import("./task-type/task-type-query").TaskTypeQuery | typeof import("./step/step-query").StepQuery | typeof import("./step/step-mutation").StepMutation | typeof import("./payload-log/payload-log-query").PayloadLogQuery | typeof import("./payload-log/payload-log-mutation").PayloadLogMutation | typeof import("./analysis/analysis-query").IntegrationAnalysisQuery | typeof import("./state-register/state-register-query").StateRegisterQuery | typeof import("./state-register/state-register-mutation").StateRegisterMutation | typeof import("./state-register/data-resolver").DataResolver)[];
16
16
  };
17
17
  export { PayloadType } from './payload-log/payload-log';
18
18
  export { createPayloadLog } from './payload-log/payload-log-mutation';
@@ -2,4 +2,4 @@ import { ScenarioInstanceQuery } from './scenario-instance-query';
2
2
  import { ScenarioInstanceMutation } from './scenario-instance-mutation';
3
3
  import { ScenarioInstanceSubscription } from './scenario-instance-subscription';
4
4
  export declare const entities: any[];
5
- export declare const resolvers: (typeof ScenarioInstanceQuery | typeof ScenarioInstanceMutation | typeof ScenarioInstanceSubscription)[];
5
+ export declare const resolvers: (typeof ScenarioInstanceSubscription | typeof ScenarioInstanceQuery | typeof ScenarioInstanceMutation)[];