stimulsoft-data-adapter 2023.4.4 → 2024.1.1

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: 2023.4.4
4
- Build date: 2023.11.21
3
+ Version: 2024.1.1
4
+ Build date: 2023.12.08
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 = "2023.4.4";
11
+ result.adapterVersion = "2024.1.1";
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: 2023.4.4
4
- Build date: 2023.11.21
3
+ Version: 2024.1.1
4
+ Build date: 2023.12.08
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 = "2023.4.4";
11
+ result.adapterVersion = "2024.1.1";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/MongoDBAdapter.js CHANGED
@@ -1,136 +1,132 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.4.4
4
- Build date: 2023.11.21
3
+ Version: 2024.1.1
4
+ Build date: 2023.12.08
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
- /*
8
- Stimulsoft.Reports.JS
9
- Version: 2023.3.3
10
- Build date: 2023.08.23
11
- License: https://www.stimulsoft.com/en/licensing/reports
12
- */
13
- exports.process = function (command, onResult) {
14
- var getSchema = async function (collection) {
15
- return (await collection.aggregate(
16
- [
17
- { '$project': { 'data': { '$objectToArray': '$$ROOT' } } },
18
- { '$unwind': '$data' },
19
- {
20
- '$group': {
21
- '_id': null,
22
- 'data': { '$addToSet': { 'k': '$data.k', 'v': { '$type': '$data.v' } } }
23
- }
24
- },
25
- { '$replaceRoot': { 'newRoot': { '$arrayToObject': '$data' } } }
26
- ]).toArray())[0];
27
- }
28
-
29
- var getType = function (type) {
30
- switch (type) {
31
- case "bool":
32
- return "boolean";
33
-
34
- case "int":
35
- case "long":
36
- case "minKey":
37
- case "maxKey":
38
- return "int";
39
-
40
- case "double":
41
- case "decimal":
42
- return "number";
43
-
44
- case "date":
45
- case "timestamp":
46
- return "datetime";
47
-
48
- case "string":
49
- case "objectId":
50
- case "regex":
51
- case "javascript":
52
- case "array":
53
- case "object":
54
- return "string";
55
-
56
- case "binData":
57
- case "null":
58
- return "array";
59
- }
60
-
61
- return "string";
62
- }
63
-
64
- setTimeout(async () => {
65
- var result = { success: false };
66
-
67
- try {
68
- var { MongoClient } = require("mongodb");
69
- var uri = command.connectionString;
70
- var client = new MongoClient(uri);
71
-
72
- await client.connect();
73
- var db = client.db(client.options.dbName);
74
-
75
- if (command.command == "TestConnection") {
76
- result = { success: true };
77
- }
78
- else if (command.command == "RetrieveSchema") {
79
- var collections = await db.listCollections().toArray();
80
- var rows = [];
81
-
82
- for (var collection of collections) {
83
- if (command.dataSource && command.dataSource != collection.name)
84
- continue;
85
-
86
- collection = db.collection(collection.name);
87
-
88
- var schema = await getSchema(collection);
89
- for (var name in schema) {
90
- rows.push([collection.collectionName, name, getType(schema[name])]);
91
- }
92
- }
93
-
94
- result = { success: true, rows };
95
- }
96
- if (command.command == "ExecuteQuery") {
97
- var rows = [];
98
- var columns = [];
99
- var types = [];
100
- collection = db.collection(command.dataSource);
101
- var schema = await getSchema(collection);
102
-
103
- for (var name in schema) {
104
- columns.push(name);
105
- types.push(getType(schema[name]));
106
- }
107
-
108
- var records = await collection.find({}).toArray();
109
- for (var record of records) {
110
- var row = [];
111
- for (var columnName in record) {
112
- var columnIndex = columns.indexOf(columnName);
113
- var value = record[columnName];
114
-
115
- value = JSON.stringify(value);
116
- if (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"')
117
- value = value.substr(1, value.length - 2)
118
-
119
- row[columnIndex] = value;
120
- }
121
-
122
- rows.push(row);
123
- }
124
-
125
- result = { success: true, rows, columns, types };
126
- }
127
- }
128
- catch (e) {
129
- result = { success: false, notice: e.message };
130
- }
131
-
132
- client.close();
133
- result.adapterVersion = "2023.4.4";
134
- onResult(result);
135
- });
7
+ exports.process = function (command, onResult) {
8
+ var getSchema = async function (collection) {
9
+ return (await collection.aggregate(
10
+ [
11
+ { '$project': { 'data': { '$objectToArray': '$$ROOT' } } },
12
+ { '$unwind': '$data' },
13
+ {
14
+ '$group': {
15
+ '_id': null,
16
+ 'data': { '$addToSet': { 'k': '$data.k', 'v': { '$type': '$data.v' } } }
17
+ }
18
+ },
19
+ { '$replaceRoot': { 'newRoot': { '$arrayToObject': '$data' } } }
20
+ ]).toArray())[0];
21
+ }
22
+
23
+ var getType = function (type) {
24
+ switch (type) {
25
+ case "bool":
26
+ return "boolean";
27
+
28
+ case "int":
29
+ case "long":
30
+ case "minKey":
31
+ case "maxKey":
32
+ return "int";
33
+
34
+ case "double":
35
+ case "decimal":
36
+ return "number";
37
+
38
+ case "date":
39
+ case "timestamp":
40
+ return "datetime";
41
+
42
+ case "string":
43
+ case "objectId":
44
+ case "regex":
45
+ case "javascript":
46
+ case "array":
47
+ case "object":
48
+ return "string";
49
+
50
+ case "binData":
51
+ case "null":
52
+ return "array";
53
+ }
54
+
55
+ return "string";
56
+ }
57
+
58
+ setTimeout(async () => {
59
+ var result = { success: false };
60
+
61
+ try {
62
+ var { MongoClient } = require("mongodb");
63
+ var uri = command.connectionString;
64
+ var client = new MongoClient(uri);
65
+
66
+ await client.connect();
67
+ var db = client.db(client.options.dbName);
68
+
69
+ if (command.command == "TestConnection") {
70
+ result = { success: true };
71
+ }
72
+ else if (command.command == "RetrieveSchema") {
73
+ var collections = await db.listCollections().toArray();
74
+ var rows = [];
75
+
76
+ for (var collection of collections) {
77
+ if (command.dataSource && command.dataSource != collection.name)
78
+ continue;
79
+
80
+ collection = db.collection(collection.name);
81
+
82
+ var schema = await getSchema(collection);
83
+ for (var name in schema) {
84
+ rows.push([collection.collectionName, name, getType(schema[name])]);
85
+ }
86
+ }
87
+
88
+ result = { success: true, rows };
89
+ }
90
+ if (command.command == "ExecuteQuery") {
91
+ var rows = [];
92
+ var columns = [];
93
+ var types = [];
94
+ collection = db.collection(command.dataSource);
95
+ var schema = await getSchema(collection);
96
+
97
+ for (var name in schema) {
98
+ columns.push(name);
99
+ types.push(getType(schema[name]));
100
+ }
101
+
102
+ var query = command.queryString ? JSON.parse(command.queryString.replace(/(['"])?([a-z0-9A-Z_]+)(['"])?:/g, '"$2": ')) : {};
103
+
104
+ var records = await collection.find(query).toArray();
105
+ for (var record of records) {
106
+ var row = [];
107
+ for (var columnName in record) {
108
+ var columnIndex = columns.indexOf(columnName);
109
+ var value = record[columnName];
110
+
111
+ value = JSON.stringify(value);
112
+ if (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"')
113
+ value = value.substr(1, value.length - 2)
114
+
115
+ row[columnIndex] = value;
116
+ }
117
+
118
+ rows.push(row);
119
+ }
120
+
121
+ result = { success: true, rows, columns, types };
122
+ }
123
+ }
124
+ catch (e) {
125
+ result = { success: false, notice: e.message };
126
+ }
127
+
128
+ client.close();
129
+ result.adapterVersion = "2024.1.1";
130
+ onResult(result);
131
+ });
136
132
  }
package/MySQLAdapter.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.4.4
4
- Build date: 2023.11.21
3
+ Version: 2024.1.1
4
+ Build date: 2023.12.08
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
@@ -13,7 +13,7 @@ exports.process = function (command, onResult) {
13
13
  catch (e) {
14
14
  }
15
15
  finally {
16
- result.adapterVersion = "2023.4.4";
16
+ result.adapterVersion = "2024.1.1";
17
17
  onResult(result);
18
18
  }
19
19
  }
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.4.4
4
- Build date: 2023.11.21
3
+ Version: 2024.1.1
4
+ Build date: 2023.12.08
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 = "2023.4.4";
11
+ result.adapterVersion = "2024.1.1";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.4.4
4
- Build date: 2023.11.21
3
+ Version: 2024.1.1
4
+ Build date: 2023.12.08
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
 
@@ -75,7 +75,7 @@ function getResponse(result) {
75
75
  return result
76
76
  }
77
77
  function onProcess(onResult, encryptData, result) {
78
- result.handlerVersion = "2023.4.4";
78
+ result.handlerVersion = "2024.1.1";
79
79
  result.checkVersion = true;
80
80
  result.encryptData = encryptData;
81
81
  onResult(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stimulsoft-data-adapter",
3
- "version": "2023.4.4",
3
+ "version": "2024.1.1",
4
4
  "description": "Nodejs data adapter for Stimulsoft Reports.JS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,11 +11,11 @@
11
11
  "url": "https://github.com/stimulsoft/DataAdapters.JS/tree/main/NodejsDataAdapters"
12
12
  },
13
13
  "dependencies": {
14
- "mongodb": "^6.1.0",
14
+ "mongodb": "^6.3.0",
15
15
  "mssql": "^6.2.1",
16
- "mysql2": "^3.6.1",
17
- "node-firebird": "^1.1.5",
18
- "oracledb": "^6.1.0",
16
+ "mysql2": "^3.6.5",
17
+ "node-firebird": "^1.1.8",
18
+ "oracledb": "^6.2.0",
19
19
  "pg": "^8.11.3",
20
20
  "tzdata": "^1.0.38"
21
21
  },