stimulsoft-data-adapter 2021.4.3 → 2022.1.3

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,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2021.4.3
4
- Build date: 2021.11.04
3
+ Version: 2022.1.3
4
+ Build date: 2022.01.12
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
8
8
  var end = function (result) {
9
9
  try {
10
10
  if (db) db.detach();
11
- result.adapterVersion = "2021.4.3";
11
+ result.adapterVersion = "2022.1.3";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/MSSQLAdapter.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2021.4.3
4
- Build date: 2021.11.04
3
+ Version: 2022.1.3
4
+ Build date: 2022.01.12
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
8
8
  var end = function (result) {
9
9
  try {
10
10
  if (connection) connection.close();
11
- result.adapterVersion = "2021.4.3";
11
+ result.adapterVersion = "2022.1.3";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/MySQLAdapter.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2021.4.3
4
- Build date: 2021.11.04
3
+ Version: 2022.1.3
4
+ Build date: 2022.01.12
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
@@ -10,7 +10,7 @@ exports.process = function (command, onResult) {
10
10
  if (connection) {
11
11
  connection.end();
12
12
  }
13
- result.adapterVersion = "2021.4.3";
13
+ result.adapterVersion = "2022.1.3";
14
14
  onResult(result);
15
15
  }
16
16
  catch (e) {
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2021.4.3
4
- Build date: 2021.11.04
3
+ Version: 2022.1.3
4
+ Build date: 2022.01.12
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
8
8
  var end = function (result) {
9
9
  try {
10
10
  if (client) client.end();
11
- result.adapterVersion = "2021.4.3";
11
+ result.adapterVersion = "2022.1.3";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/app.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2021.4.3
4
- Build date: 2021.11.04
3
+ Version: 2022.1.3
4
+ Build date: 2022.01.12
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  var http = require('http');
@@ -10,8 +10,8 @@ var FirebirdAdapter = require('./FirebirdAdapter');
10
10
  var MSSQLAdapter = require('./MSSQLAdapter');
11
11
  var PostgreSQLAdapter = require('./PostgreSQLAdapter');
12
12
 
13
- var connectionStringBuilder;
14
13
  var response;
14
+
15
15
  function accept(req, res) {
16
16
  response = res;
17
17
  response.setHeader("Access-Control-Allow-Origin", "*");
@@ -25,22 +25,33 @@ function accept(req, res) {
25
25
  });
26
26
 
27
27
  req.on('end', function () {
28
- if (data.indexOf("{") != 0) {
28
+ var encryptResult = false;
29
+ if (!data.startsWith("{")) {
29
30
  data = Buffer.from(data.replace(/[A-Za-z]/g, function (c) {
30
31
  return String.fromCharCode(c.charCodeAt(0) + (c.toUpperCase() <= "M" ? 13 : -13));
31
32
  }), "base64").toString("ascii");
32
-
33
+ encryptResult = true;
33
34
  }
34
35
 
36
+ var onProcessHandler = onProcess.bind(null, encryptResult);
37
+
35
38
  command = JSON.parse(data.toString());
36
39
 
37
- command.queryString = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
40
+ if (command.command === "GetSupportedAdapters") {
41
+ let result = {
42
+ success: true,
43
+ types: ["MySQL", "MS SQL", "Firebird", "PostgreSQL"]
44
+ };
45
+ onProcessHandler(result);
46
+ } else {
47
+ command.queryString = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
38
48
 
39
- if (command.database == "MySQL") MySQLAdapter.process(command, onProcess);
40
- else if (command.database == "Firebird") FirebirdAdapter.process(command, onProcess);
41
- else if (command.database == "MS SQL") MSSQLAdapter.process(command, onProcess);
42
- else if (command.database == "PostgreSQL") PostgreSQLAdapter.process(command, onProcess);
43
- else onResult({ success: false, notice: "Database '" + command.database + "' not supported!" });
49
+ if (command.database == "MySQL") MySQLAdapter.process(command, onProcessHandler);
50
+ else if (command.database == "Firebird") FirebirdAdapter.process(command, onProcessHandler);
51
+ else if (command.database == "MS SQL") MSSQLAdapter.process(command, onProcessHandler);
52
+ else if (command.database == "PostgreSQL") PostgreSQLAdapter.process(command, onProcessHandler);
53
+ else onProcessHandler({ success: false, notice: "Database '" + command.database + "' not supported!" });
54
+ }
44
55
  });
45
56
  }
46
57
 
@@ -81,9 +92,15 @@ var applyQueryParameters = function (baseSqlCommand, parameters, escapeQueryPara
81
92
  return result + baseSqlCommand;
82
93
  }
83
94
 
84
- var onProcess = function (result) {
85
- result.handlerVersion = "2021.4.3";
86
- response.end(JSON.stringify(result));
95
+ var onProcess = function (encryptData, result) {
96
+ result.handlerVersion = "2022.1.3";
97
+ result = JSON.stringify(result);
98
+ if (encryptData) {
99
+ result = Buffer.from(result).toString("base64").replace(/[A-Za-z]/g, function (c) {
100
+ return String.fromCharCode(c.charCodeAt(0) + (c.toUpperCase() <= "M" ? 13 : -13));
101
+ });
102
+ }
103
+ response.end(result);
87
104
  }
88
105
 
89
106
  http.createServer(accept).listen(9615);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stimulsoft-data-adapter",
3
- "version": "2021.4.3",
3
+ "version": "2022.1.3",
4
4
  "description": "Nodejs data adapter for Stimulsoft Reports.JS",
5
5
  "main": "app.js",
6
6
  "scripts": {