@crowdin/app-project-module 0.20.9 → 0.20.11

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.
@@ -40,7 +40,10 @@ function handleBuildFile(baseUrl, dataFolder, config, req, client, context, proj
40
40
  strings = req.strings;
41
41
  }
42
42
  else {
43
- strings = JSON.parse((yield axios_1.default.get(req.stringsUrl)).data);
43
+ // the response is presented in the ndjson format
44
+ const response = (yield axios_1.default.get(req.stringsUrl)).data;
45
+ const jsonRows = response.split(/\n|\n\r/).filter(Boolean);
46
+ strings = jsonRows.map((jsonStringRow) => JSON.parse(jsonStringRow));
44
47
  }
45
48
  let res;
46
49
  if ((req.file.id || !file) && config.exportStrings) {
@@ -135,7 +138,13 @@ function handle(baseConfig, baseUrl, folder, config) {
135
138
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
136
139
  const baseFilesUrl = `${baseUrl}/file/download`;
137
140
  const body = req.body;
138
- const logData = Object.assign({}, body, { strings: body.strings.slice(0, 5) });
141
+ let logData;
142
+ if (body.strings) {
143
+ logData = Object.assign({}, body, { strings: body.strings.slice(0, 5) });
144
+ }
145
+ else {
146
+ logData = body;
147
+ }
139
148
  (0, util_1.log)(`Received request to process file ${JSON.stringify(logData, null, 2)}`, baseConfig.logger);
140
149
  let file;
141
150
  if (body.file.content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "0.20.9",
3
+ "version": "0.20.11",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",