@sap_oss/wdio-qmate-service 1.0.0 → 1.0.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.
- package/README.md +2 -1
- package/{test/core/package-lock.json → docs/bestPractices/spec.md} +0 -0
- package/docs/doc.md +176 -353
- package/docs/gettingStarted/setup.md +2 -2
- package/docs/index.md +1 -1
- package/docs/sections/bestPractices/authentication.md +151 -0
- package/docs/sections/bestPractices/dataHandling.md +61 -0
- package/docs/sections/bestPractices/selectors.md +44 -0
- package/docs/{contact.md → sections/contact.md} +0 -0
- package/docs/sections/features/advancedDataHandling.md +252 -0
- package/docs/sections/features/config.md +171 -0
- package/docs/sections/features/dataHandling.md +83 -0
- package/docs/{gettingStarted → sections/features}/selectors.md +0 -0
- package/docs/sections/features/spec.md +0 -0
- package/docs/sections/gettingStarted/config.md +18 -0
- package/docs/sections/gettingStarted/execution.md +7 -0
- package/docs/sections/gettingStarted/setup.md +9 -0
- package/docs/sections/gettingStarted/spec.md +31 -0
- package/docs/sections/gettingStarted/specs.md +19 -0
- package/docs/sections/support/bugReporting.md +19 -0
- package/docs/sections/support/knownIssuesAndLimitations.md +0 -0
- package/docs/sections/support/troubleshooting.md +16 -0
- package/docs/sources/images/fiori_form.PNG +0 -0
- package/docs/sources/images/sapCloud_form.PNG +0 -0
- package/lib/index.js +59 -82
- package/lib/index.js.map +1 -1
- package/lib/reuse/authenticator/authHandler.js +12 -23
- package/lib/reuse/authenticator/authHandler.js.map +1 -1
- package/lib/reuse/authenticator/basicUrlAuthenticator.js +21 -32
- package/lib/reuse/authenticator/basicUrlAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/customAuthenticator.js +42 -55
- package/lib/reuse/authenticator/customAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/formAuthenticator.js +37 -50
- package/lib/reuse/authenticator/formAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/plainAuthenticator.js +5 -16
- package/lib/reuse/authenticator/plainAuthenticator.js.map +1 -1
- package/lib/reuse/helper/jsDocGen.js +4 -12
- package/lib/reuse/helper/jsDocGen.js.map +1 -1
- package/lib/reuse/index.js +20 -5
- package/lib/reuse/index.js.map +1 -1
- package/lib/reuse/modules/common/navigation.js +10 -23
- package/lib/reuse/modules/common/navigation.js.map +1 -1
- package/lib/reuse/modules/common/userInteraction.js +40 -73
- package/lib/reuse/modules/common/userInteraction.js.map +1 -1
- package/lib/reuse/modules/nonUi5/assertion.js +31 -52
- package/lib/reuse/modules/nonUi5/assertion.js.map +1 -1
- package/lib/reuse/modules/nonUi5/element.js +266 -331
- package/lib/reuse/modules/nonUi5/element.js.map +1 -1
- package/lib/reuse/modules/nonUi5/navigation.js +10 -21
- package/lib/reuse/modules/nonUi5/navigation.js.map +1 -1
- package/lib/reuse/modules/nonUi5/userInteraction.js +176 -215
- package/lib/reuse/modules/nonUi5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/service/odata.d.ts +106 -94
- package/lib/reuse/modules/service/odata.js +209 -204
- package/lib/reuse/modules/service/odata.js.map +1 -1
- package/lib/reuse/modules/service/rest.js +64 -81
- package/lib/reuse/modules/service/rest.js.map +1 -1
- package/lib/reuse/modules/ui5/assertion.js +217 -268
- package/lib/reuse/modules/ui5/assertion.js.map +1 -1
- package/lib/reuse/modules/ui5/confirmationDialog.js +17 -42
- package/lib/reuse/modules/ui5/confirmationDialog.js.map +1 -1
- package/lib/reuse/modules/ui5/control.js +12 -33
- package/lib/reuse/modules/ui5/control.js.map +1 -1
- package/lib/reuse/modules/ui5/date.js +70 -89
- package/lib/reuse/modules/ui5/date.js.map +1 -1
- package/lib/reuse/modules/ui5/element.js +121 -156
- package/lib/reuse/modules/ui5/element.js.map +1 -1
- package/lib/reuse/modules/ui5/errorDialog.js +4 -17
- package/lib/reuse/modules/ui5/errorDialog.js.map +1 -1
- package/lib/reuse/modules/ui5/footerBar.js +28 -63
- package/lib/reuse/modules/ui5/footerBar.js.map +1 -1
- package/lib/reuse/modules/ui5/mockserver.js +390 -427
- package/lib/reuse/modules/ui5/mockserver.js.map +1 -1
- package/lib/reuse/modules/ui5/navigation.js +105 -132
- package/lib/reuse/modules/ui5/navigation.js.map +1 -1
- package/lib/reuse/modules/ui5/navigationBar.js +58 -77
- package/lib/reuse/modules/ui5/navigationBar.js.map +1 -1
- package/lib/reuse/modules/ui5/qunit.js +16 -27
- package/lib/reuse/modules/ui5/qunit.js.map +1 -1
- package/lib/reuse/modules/ui5/session.js +200 -236
- package/lib/reuse/modules/ui5/session.js.map +1 -1
- package/lib/reuse/modules/ui5/table.js +79 -98
- package/lib/reuse/modules/ui5/table.js.map +1 -1
- package/lib/reuse/modules/ui5/userInteraction.js +264 -335
- package/lib/reuse/modules/ui5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/util/browser.js +131 -178
- package/lib/reuse/modules/util/browser.js.map +1 -1
- package/lib/reuse/modules/util/data.js +3 -2
- package/lib/reuse/modules/util/data.js.map +1 -1
- package/lib/reuse/modules/util/file.js +71 -90
- package/lib/reuse/modules/util/file.js.map +1 -1
- package/lib/reuse/modules/util/function.js +68 -87
- package/lib/reuse/modules/util/function.js.map +1 -1
- package/lib/reuse/modules/util/system.js +22 -33
- package/lib/reuse/modules/util/system.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchange.js +145 -160
- package/lib/scripts/dataExchange/dataExchange.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchangeUtil.js +93 -114
- package/lib/scripts/dataExchange/dataExchangeUtil.js.map +1 -1
- package/lib/scripts/hooks/after.js +3 -14
- package/lib/scripts/hooks/after.js.map +1 -1
- package/lib/scripts/hooks/before.js +9 -20
- package/lib/scripts/hooks/before.js.map +1 -1
- package/lib/scripts/hooks/beforeSession.js +7 -18
- package/lib/scripts/hooks/beforeSession.js.map +1 -1
- package/lib/scripts/hooks/onComplete.js +2 -13
- package/lib/scripts/hooks/onComplete.js.map +1 -1
- package/lib/scripts/hooks/onPrepare.js +9 -20
- package/lib/scripts/hooks/onPrepare.js.map +1 -1
- package/lib/scripts/hooks/utils/addLocatorCommands.js +109 -172
- package/lib/scripts/hooks/utils/addLocatorCommands.js.map +1 -1
- package/lib/scripts/hooks/utils/browserLog.js +18 -31
- package/lib/scripts/hooks/utils/browserLog.js.map +1 -1
- package/lib/scripts/hooks/utils/dataExchangeCommands.js +13 -24
- package/lib/scripts/hooks/utils/dataExchangeCommands.js.map +1 -1
- package/lib/scripts/hooks/utils/decryption.d.ts +1 -1
- package/lib/scripts/hooks/utils/decryption.js +33 -14
- package/lib/scripts/hooks/utils/decryption.js.map +1 -1
- package/lib/scripts/hooks/utils/lib.js +249 -272
- package/lib/scripts/hooks/utils/lib.js.map +1 -1
- package/lib/scripts/hooks/utils/locatorCommands.js +154 -183
- package/lib/scripts/hooks/utils/locatorCommands.js.map +1 -1
- package/mkdocs.yml +16 -3
- package/package.json +14 -11
- package/test/authenticator/staticLogin/specs/custom.spec.js +30 -1
- package/test/reuse/nonUi5/element/getById.spec.js +17 -0
- package/test/reuse/service/odata/get.spec.js +61 -0
- package/test/reuse/service/odata/getEntitySet.spec.js +87 -0
- package/test/reuse/service/odata/test.odata.conf.js +15 -0
- package/test/reuse/ui5/confirmationDialog/clickButton.spec.js +87 -0
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.conf.js +2 -1
- package/test/reuse/ui5/element/test.element.conf.js +2 -1
- package/test/reuse/ui5/element/waitForAll.spec.js +46 -0
- package/test/reuse/ui5/userInteraction/clearAndFillSmartFieldInputAndRetry.spec.js +28 -0
- package/test/reuse/ui5/userInteraction/test.userInteraction.conf.js +1 -0
- package/test/reuse/util/browser/switchToNewWindow.spec.js +2 -2
- package/test/reuse/util/console/console.spec.js +27 -0
- package/test/reuse/util/console/test.console.conf.js +12 -0
- package/test/reuse/util/data/data/test.secure.json +7 -3
- package/test/reuse/util/data/getSecureData.spec.js +9 -3
- package/test/reuse/util/file/pdfParser.spec.js +33 -8
- package/test/reuse/util/system/system.spec.js +16 -0
- package/test/reuse/util/system/test.system.conf.js +12 -0
- package/tsconfig.json +1 -1
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -27,47 +18,45 @@ class DataExchange {
|
|
|
27
18
|
* @description read the import and export params in the config file
|
|
28
19
|
* @example await readParams();
|
|
29
20
|
*/
|
|
30
|
-
readParams() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
async readParams() {
|
|
22
|
+
if (!browser.config.params) {
|
|
23
|
+
//nothing to do
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!browser.params) {
|
|
27
|
+
browser.params = browser.config.params;
|
|
28
|
+
}
|
|
29
|
+
const importParams = browser.params.import || {};
|
|
30
|
+
// import
|
|
31
|
+
// read folders, and subfolders if directory, otherwise read file
|
|
32
|
+
const params = Object.keys(importParams);
|
|
33
|
+
for (let i = 0; i < params.length; i++) {
|
|
34
|
+
const param = params[i];
|
|
35
|
+
// adjust file path if relative
|
|
36
|
+
const fileOrDir = dataExchangeUtil_1.default.getFileAbsPath(importParams[param]);
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
const isFileReadable = await dataExchangeUtil_1.default.isReadable(fileOrDir);
|
|
39
|
+
if (isFileReadable) {
|
|
47
40
|
// @ts-ignore
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
browser.params.
|
|
67
|
-
// if export file has data, should that be used?
|
|
68
|
-
Object.keys(exportParams).forEach((param) => {
|
|
69
|
-
browser.params.export[param] = null;
|
|
70
|
-
});
|
|
41
|
+
await dataExchangeUtil_1.default.readData(fileOrDir, [param]);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
delete importParams[param];
|
|
45
|
+
console.warn(`"${fileOrDir}" does not exist or is not readable. Please check path or permissions.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// for export, create folders and files if not present
|
|
49
|
+
// copy filenames, since the user will overwrite browser.params.export with data
|
|
50
|
+
// the filenames are required to write the json data at end of session
|
|
51
|
+
const exportParams = browser.params.export;
|
|
52
|
+
if (!exportParams) {
|
|
53
|
+
// nothing to export
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
browser.params.exportDataFiles = { ...exportParams };
|
|
57
|
+
// if export file has data, should that be used?
|
|
58
|
+
Object.keys(exportParams).forEach((param) => {
|
|
59
|
+
browser.params.export[param] = null;
|
|
71
60
|
});
|
|
72
61
|
}
|
|
73
62
|
;
|
|
@@ -77,44 +66,42 @@ class DataExchange {
|
|
|
77
66
|
* in these temporary files will be merged after all instances complete
|
|
78
67
|
* @example await writeExportDataInTmpFile();
|
|
79
68
|
*/
|
|
80
|
-
writeExportDataInTmpFile() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
69
|
+
async writeExportDataInTmpFile() {
|
|
70
|
+
if (!browser.params || !browser.params.exportDataFiles) {
|
|
71
|
+
// no export data files in config.js, nothing to do
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!process.env.TMP_EXPORT_PATH) {
|
|
75
|
+
console.warn("Unexpected error - process.env.TMP_EXPORT_PATH not defined");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!browser.params.export) {
|
|
79
|
+
console.warn("Unexpected error - browser.params.export not defined, no export data to be written out");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const date = new Date().getTime();
|
|
83
|
+
const keyFileWithPath = path_1.default.join(process.env.TMP_EXPORT_PATH, date + ".exportDataFiles");
|
|
84
|
+
try {
|
|
85
|
+
await dataExchangeUtil_1.default.outputJson(keyFileWithPath, browser.params.exportDataFiles, { spaces: 2 });
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
console.warn(`Could not write export key data in tmp file ${keyFileWithPath}`);
|
|
89
|
+
console.warn(err);
|
|
90
|
+
}
|
|
91
|
+
const keys = Object.keys(browser.params.exportDataFiles);
|
|
92
|
+
//use for loop so all files get written before promise is resolved
|
|
93
|
+
for (let i = 0; i < keys.length; i++) {
|
|
94
|
+
const param = keys[i];
|
|
95
|
+
const fileWithPath = path_1.default.join(process.env.TMP_EXPORT_PATH, param + "." + date);
|
|
96
|
+
const data = browser.params.export[param] || {};
|
|
96
97
|
try {
|
|
97
|
-
|
|
98
|
+
await fs_extra_1.default.outputJson(fileWithPath, data, { spaces: 2 });
|
|
98
99
|
}
|
|
99
100
|
catch (err) {
|
|
100
|
-
console.warn(`Could not write export
|
|
101
|
+
console.warn(`Could not write export data in tmp file ${fileWithPath}`);
|
|
101
102
|
console.warn(err);
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
-
//use for loop so all files get written before promise is resolved
|
|
105
|
-
for (let i = 0; i < keys.length; i++) {
|
|
106
|
-
const param = keys[i];
|
|
107
|
-
const fileWithPath = path_1.default.join(process.env.TMP_EXPORT_PATH, param + "." + date);
|
|
108
|
-
const data = browser.params.export[param] || {};
|
|
109
|
-
try {
|
|
110
|
-
yield fs_extra_1.default.outputJson(fileWithPath, data, { spaces: 2 });
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
console.warn(`Could not write export data in tmp file ${fileWithPath}`);
|
|
114
|
-
console.warn(err);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
});
|
|
104
|
+
}
|
|
118
105
|
}
|
|
119
106
|
;
|
|
120
107
|
/**
|
|
@@ -123,99 +110,97 @@ class DataExchange {
|
|
|
123
110
|
* files and merges the data.
|
|
124
111
|
* @example await writeExportData();
|
|
125
112
|
*/
|
|
126
|
-
writeExportData() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
113
|
+
async writeExportData() {
|
|
114
|
+
if (!process.env.TMP_EXPORT_PATH) {
|
|
115
|
+
console.warn("Unexpected error - process.env.TMP_EXPORT_PATH not defined");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let files;
|
|
119
|
+
try {
|
|
120
|
+
files = await fs_extra_1.default.readdir(process.env.TMP_EXPORT_PATH);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
console.warn(`Could not read export data in tmp folder ${process.env.TMP_EXPORT_PATH}`);
|
|
124
|
+
console.warn(err);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
files.sort();
|
|
128
|
+
const exportData = {};
|
|
129
|
+
let exportDataFiles = {};
|
|
130
|
+
// loop through the files in sequence, for loop ensures all files are
|
|
131
|
+
// read before we go to the next step
|
|
132
|
+
for (const file of files) {
|
|
133
|
+
const fileWithPath = path_1.default.resolve(process.env.TMP_EXPORT_PATH, file);
|
|
133
134
|
try {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
const match = file.match(/^[0-9]+\.exportDataFiles$/);
|
|
155
|
-
const keyMatch = file.match(/^(.*)\.[0-9]+$/);
|
|
156
|
-
if (match) {
|
|
157
|
-
exportDataFiles = data;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
if (keyMatch && keyMatch.length > 1) {
|
|
161
|
-
const key = keyMatch[1];
|
|
162
|
-
if (key) {
|
|
163
|
-
// if array join the elements
|
|
164
|
-
if (Array.isArray(data) && (!exportData[key] || Array.isArray(exportData[key]))) {
|
|
165
|
-
if (exportData[key]) {
|
|
166
|
-
exportData[key] = [...exportData[key], ...data];
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
exportData[key] = [...data];
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
else if (Array.isArray(data) && !exportData[key] && !Array.isArray(exportData[key])) {
|
|
173
|
-
console.warn(`Unexpected array and non array data for export key ${key}`);
|
|
174
|
-
exportData[key] = Object.assign(Object.assign({}, exportData[key]), data);
|
|
135
|
+
const data = await dataExchangeUtil_1.default.readJson(fileWithPath);
|
|
136
|
+
// if no data (empty object or array) don't do anything
|
|
137
|
+
if (!data || Object.keys(data).length <= 0) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const match = file.match(/^[0-9]+\.exportDataFiles$/);
|
|
141
|
+
const keyMatch = file.match(/^(.*)\.[0-9]+$/);
|
|
142
|
+
if (match) {
|
|
143
|
+
exportDataFiles = data;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
if (keyMatch && keyMatch.length > 1) {
|
|
147
|
+
const key = keyMatch[1];
|
|
148
|
+
if (key) {
|
|
149
|
+
// if array join the elements
|
|
150
|
+
if (Array.isArray(data) && (!exportData[key] || Array.isArray(exportData[key]))) {
|
|
151
|
+
if (exportData[key]) {
|
|
152
|
+
exportData[key] = [...exportData[key], ...data];
|
|
175
153
|
}
|
|
176
154
|
else {
|
|
177
|
-
exportData[key] =
|
|
155
|
+
exportData[key] = [...data];
|
|
178
156
|
}
|
|
179
157
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
158
|
+
else if (Array.isArray(data) && !exportData[key] && !Array.isArray(exportData[key])) {
|
|
159
|
+
console.warn(`Unexpected array and non array data for export key ${key}`);
|
|
160
|
+
exportData[key] = { ...exportData[key], ...data };
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
exportData[key] = { ...exportData[key], ...data };
|
|
164
|
+
}
|
|
183
165
|
}
|
|
184
166
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
console.warn(err);
|
|
167
|
+
else {
|
|
168
|
+
console.warn(`Unexpected error - temporary export file ${fileWithPath} does not have timestamp in its name`);
|
|
169
|
+
}
|
|
189
170
|
}
|
|
190
171
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
let fileWithPath = exportDataFiles[param];
|
|
195
|
-
if (!fileWithPath) {
|
|
196
|
-
console.warn(`Unexpected error - no file name for key ${param}`);
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
// adjust relative file paths
|
|
200
|
-
fileWithPath = dataExchangeUtil_1.default.getFileAbsPath(fileWithPath);
|
|
201
|
-
const data = exportData[param];
|
|
202
|
-
try {
|
|
203
|
-
yield dataExchangeUtil_1.default.outputJson(fileWithPath, data, { spaces: 2 });
|
|
204
|
-
}
|
|
205
|
-
catch (err) {
|
|
206
|
-
console.warn(`Could not write export data to file, make sure that ${fileWithPath} is valid and writable`);
|
|
207
|
-
console.warn(err);
|
|
208
|
-
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
console.warn(`Could not read export data in tmp file ${fileWithPath}`);
|
|
174
|
+
console.warn(err);
|
|
209
175
|
}
|
|
176
|
+
}
|
|
177
|
+
const keys = Object.keys(exportDataFiles);
|
|
178
|
+
// use for loop to make sure all files are written before we remove the tmp folder
|
|
179
|
+
for (const param of keys) {
|
|
180
|
+
let fileWithPath = exportDataFiles[param];
|
|
181
|
+
if (!fileWithPath) {
|
|
182
|
+
console.warn(`Unexpected error - no file name for key ${param}`);
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// adjust relative file paths
|
|
186
|
+
fileWithPath = dataExchangeUtil_1.default.getFileAbsPath(fileWithPath);
|
|
187
|
+
const data = exportData[param];
|
|
210
188
|
try {
|
|
211
|
-
|
|
212
|
-
yield fs_extra_1.default.remove(process.env.TMP_EXPORT_PATH);
|
|
189
|
+
await dataExchangeUtil_1.default.outputJson(fileWithPath, data, { spaces: 2 });
|
|
213
190
|
}
|
|
214
191
|
catch (err) {
|
|
215
|
-
console.warn(`Could not
|
|
192
|
+
console.warn(`Could not write export data to file, make sure that ${fileWithPath} is valid and writable`);
|
|
216
193
|
console.warn(err);
|
|
217
194
|
}
|
|
218
|
-
}
|
|
195
|
+
}
|
|
196
|
+
try {
|
|
197
|
+
// remove tmp folder, ignore if this call fails
|
|
198
|
+
await fs_extra_1.default.remove(process.env.TMP_EXPORT_PATH);
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
console.warn(`Could not remove temporary folder ${process.env.TMP_EXPORT_PATH}`);
|
|
202
|
+
console.warn(err);
|
|
203
|
+
}
|
|
219
204
|
}
|
|
220
205
|
;
|
|
221
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataExchange.js","sourceRoot":"","sources":["../../../src/scripts/dataExchange/dataExchange.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataExchange.js","sourceRoot":"","sources":["../../../src/scripts/dataExchange/dataExchange.ts"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B;;;;GAIG;AACH,wDAAyB;AACzB,gDAAwB;AACxB,0EAAsD;AAEtD,MAAM,YAAY;IAEhB;;;;OAIG;IAEH,KAAK,CAAC,UAAU;QAEd,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;YAC1B,eAAe;YACf,OAAO;SACR;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;SACxC;QACD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;QAEjD,SAAS;QACT,iEAAiE;QACjE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACxB,+BAA+B;YAC/B,MAAM,SAAS,GAAG,0BAAoB,CAAC,cAAc,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;YAC3E,aAAa;YACb,MAAM,cAAc,GAAG,MAAM,0BAAoB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YACxE,IAAI,cAAc,EAAE;gBAClB,aAAa;gBACb,MAAM,0BAAoB,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;aACzD;iBAAM;gBACL,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;gBAC3B,OAAO,CAAC,IAAI,C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