@steerprotocol/data-connector-loader 0.2.0 → 2.0.0
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.
|
@@ -19,6 +19,7 @@ class DataConnectorExecution extends executionBase_1.ExecutionBase {
|
|
|
19
19
|
this.dataConnectors = dataConnectors;
|
|
20
20
|
}
|
|
21
21
|
execute(_vaultConfig) {
|
|
22
|
+
var _a;
|
|
22
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
24
|
const vaultConfig = JSON.parse(_vaultConfig);
|
|
24
25
|
const transformationData = [];
|
|
@@ -30,10 +31,17 @@ class DataConnectorExecution extends executionBase_1.ExecutionBase {
|
|
|
30
31
|
}
|
|
31
32
|
const executionContext = yield this.getExecutionContext(dataConnector, vaultConfig);
|
|
32
33
|
dataConnector.setExecutionContextDataConnector(executionContext);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
if (((_a = dataConnector.module) === null || _a === void 0 ? void 0 : _a.version()) == 1) {
|
|
35
|
+
const initialRequest = yield dataConnector.execute('');
|
|
36
|
+
const finalResponse = yield this.handleRequestResponse(dataConnector, pluginManager, initialRequest);
|
|
37
|
+
const transformedData = yield this.transformData(dataConnector, finalResponse);
|
|
38
|
+
transformationData.push(transformedData);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const finalResponse = yield dataConnector.execute('');
|
|
42
|
+
const transformedData = yield this.transformData(dataConnector, finalResponse);
|
|
43
|
+
transformationData.push(transformedData);
|
|
44
|
+
}
|
|
37
45
|
}
|
|
38
46
|
return transformationData;
|
|
39
47
|
});
|
|
@@ -70,6 +78,16 @@ class DataConnectorExecution extends executionBase_1.ExecutionBase {
|
|
|
70
78
|
var _a, _b, _c;
|
|
71
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
80
|
let transformedData = typeof rawData === 'string' ? JSON.parse(rawData) : rawData;
|
|
81
|
+
if (transformedData == null || transformedData.length == 0) {
|
|
82
|
+
const results = dataConnector.getResults();
|
|
83
|
+
const parsedResults = JSON.parse(results);
|
|
84
|
+
if (parsedResults.length == null) {
|
|
85
|
+
transformedData = results;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
transformedData = parsedResults;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
73
91
|
const version = yield this.getDataConnectorVersion(dataConnector);
|
|
74
92
|
if (version == 1 && transformedData.length > 0) {
|
|
75
93
|
const keys = Object.keys(transformedData[0]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerprotocol/data-connector-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "App Loader for Steer Protocol",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"lib/**/*"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@steerprotocol/app-loader": "1.0
|
|
50
|
-
"@steerprotocol/strategy-utils": "^3.1.
|
|
49
|
+
"@steerprotocol/app-loader": "1.1.0",
|
|
50
|
+
"@steerprotocol/strategy-utils": "^3.1.2",
|
|
51
51
|
"axios": "^1.3.4",
|
|
52
52
|
"ethers": "^5.1.0",
|
|
53
53
|
"timestring": "^7.0.0"
|