@ind-rcg/backend 246.1008.0 → 248.1006.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.
- package/bin/libsqliteExtension.dylib +0 -0
- package/package.json +5 -6
- package/src/local.js +21 -7
- package/src/sfAttachmentsHandler.js +1 -1
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ind-rcg/backend",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "248.1006.0",
|
|
4
4
|
"author": "Salesforce",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"description": "This backend module is required to simulate the application of Consumer Goods Mobile Application. This modules can only be used in modeler-sfdx-cli-plugin.",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"bindings": "1.5.0",
|
|
9
9
|
"body-parser": "1.20.1",
|
|
10
|
-
"client-oauth2": "4.3.3",
|
|
11
10
|
"copyfiles": "2.4.1",
|
|
12
11
|
"express": "4.18.2",
|
|
13
12
|
"lodash": "4.17.21",
|
|
@@ -18,14 +17,14 @@
|
|
|
18
17
|
"node-fetch": "3.3.0",
|
|
19
18
|
"pako": "2.0.4",
|
|
20
19
|
"rimraf": "3.0.2",
|
|
21
|
-
"sharp": "0.
|
|
20
|
+
"sharp": "0.32.6",
|
|
22
21
|
"sqlite3": "5.1.6",
|
|
23
22
|
"sqlite3-transactions": "0.0.5",
|
|
24
|
-
"ssl-root-cas": "1.3.1",
|
|
25
23
|
"yargs": "17.5.1"
|
|
26
24
|
},
|
|
27
25
|
"scripts": {
|
|
28
|
-
"test": "mocha --recursive --timeout
|
|
26
|
+
"test": "mocha --recursive --timeout 3000 --retries 3",
|
|
27
|
+
"testSingle": "mocha test/local-test.js --timeout 3000 --retries 3",
|
|
29
28
|
"lint": "npx eslint *.js src/*.js src/**/*.js test/*.js test/**/*.js",
|
|
30
29
|
"start": "node src/server.js",
|
|
31
30
|
"nativeConfigure": "node-gyp configure",
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
"log4js.json"
|
|
60
59
|
],
|
|
61
60
|
"devDependencies": {
|
|
62
|
-
"@ind-rcg/com-salesforce-rcg-sqlite-extensions": "
|
|
61
|
+
"@ind-rcg/com-salesforce-rcg-sqlite-extensions": "248.1000.0",
|
|
63
62
|
"chai": "4.3.4",
|
|
64
63
|
"eslint": "8.40.0",
|
|
65
64
|
"jszip": "3.10.1",
|
package/src/local.js
CHANGED
|
@@ -82,16 +82,28 @@ let initialize = (webServerConfig) => {
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
let closeDBConnection = () => {
|
|
85
|
+
let closeDBConnection = (closeCb) => {
|
|
86
|
+
let success=false;
|
|
87
|
+
let fallbackCb = ()=>{};
|
|
88
|
+
let cb = closeCb || fallbackCb;
|
|
89
|
+
|
|
86
90
|
//closing the db connection
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
let closeDBResponse;
|
|
92
|
+
if (priceEngine) {
|
|
93
|
+
closeDBResponse = priceEngine.closeDbConnection();
|
|
94
|
+
success = closeDBResponse.success;
|
|
95
|
+
//failure occurred
|
|
96
|
+
if(!success) {
|
|
97
|
+
log.error(`We couldn’t complete the closeDbConnection operation. Try again or contact Salesforce Support and provide the error details: ${JSON.stringify(closeDBResponse?.results?.messages)}`);
|
|
98
|
+
}
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
|
|
101
|
+
//closing sqlite connection
|
|
102
|
+
if (db && db.open) db.close(cb);
|
|
103
|
+
else cb();
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return success;
|
|
95
107
|
};
|
|
96
108
|
|
|
97
109
|
let sendResponse = (startTime, resultSet, res) => {
|
|
@@ -120,6 +132,7 @@ let execCall = (payload, res) => {
|
|
|
120
132
|
if (!query) return;
|
|
121
133
|
query = query.trim();
|
|
122
134
|
let cb = function(err){
|
|
135
|
+
if (this.prepared) this.finalize();
|
|
123
136
|
let result = {
|
|
124
137
|
"result": true
|
|
125
138
|
};
|
|
@@ -136,6 +149,7 @@ let execCall = (payload, res) => {
|
|
|
136
149
|
};
|
|
137
150
|
if (params) {
|
|
138
151
|
let stmt = dbRef.prepare(query);
|
|
152
|
+
stmt.prepared = true;
|
|
139
153
|
stmt.run(params, cb);
|
|
140
154
|
} else {
|
|
141
155
|
dbRef.run(query, cb);
|
|
@@ -94,7 +94,7 @@ const SFAttachmentsHandler = new function () {
|
|
|
94
94
|
|
|
95
95
|
if (Utils.isFilePathValid(filePath)) {
|
|
96
96
|
// TODO: recheck the file path verification logic
|
|
97
|
-
if (filePath.startsWith(Utils.getAttachmentFolderName() + path.sep)) {
|
|
97
|
+
if (filePath.startsWith(Utils.getAttachmentFolderName() + path.posix.sep)) {
|
|
98
98
|
if (fs.existsSync(filePath)) {
|
|
99
99
|
base64EncodedData = fs.readFileSync(filePath, { encoding: "base64" });
|
|
100
100
|
} else {
|