@crowdin/app-project-module 1.9.0 → 1.11.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.
Files changed (30) hide show
  1. package/out/modules/api/api.js +323 -18
  2. package/out/modules/api/components.d.ts +222 -19
  3. package/out/modules/api/components.js +222 -19
  4. package/out/modules/custom-mt/index.js +2 -1
  5. package/out/modules/file-processing/handlers/file-download.js +2 -1
  6. package/out/modules/file-processing/handlers/pre-post-process.js +2 -1
  7. package/out/modules/file-processing/handlers/translations-alignment.js +2 -1
  8. package/out/modules/file-processing/index.js +3 -2
  9. package/out/modules/file-processing/util/folder.d.ts +1 -0
  10. package/out/modules/file-processing/util/folder.js +13 -0
  11. package/out/modules/integration/handlers/crowdin-file-progress.js +5 -2
  12. package/out/modules/integration/handlers/integration-data.js +14 -2
  13. package/out/modules/integration/handlers/job-list.js +4 -1
  14. package/out/modules/integration/handlers/settings-save.js +85 -42
  15. package/out/modules/integration/handlers/settings-schema.d.ts +3 -0
  16. package/out/modules/integration/handlers/settings-schema.js +29 -0
  17. package/out/modules/integration/handlers/sync-settings-save.js +57 -3
  18. package/out/modules/integration/handlers/sync-settings.js +11 -3
  19. package/out/modules/integration/types.d.ts +7 -0
  20. package/out/modules/integration/util/files.js +19 -7
  21. package/out/modules/integration/util/job.d.ts +2 -1
  22. package/out/modules/integration/util/job.js +3 -2
  23. package/out/modules/integration/util/types.d.ts +4 -2
  24. package/out/modules/integration/util/types.js +2 -0
  25. package/out/static/ui/main.bundle.js +94 -3
  26. package/out/static/ui/main.bundle.js.map +1 -1
  27. package/out/util/index.js +3 -1
  28. package/out/util/logger.d.ts +1 -0
  29. package/out/util/logger.js +7 -0
  30. package/package.json +14 -9
package/out/util/index.js CHANGED
@@ -103,7 +103,9 @@ function handleError(err, req, res) {
103
103
  }
104
104
  if (!res.headersSent) {
105
105
  const errorMessage = { message: (0, logger_1.getErrorMessage)(err), code };
106
- if ('integrationCredentials' in req) {
106
+ const isApiCall = isCrowdinClientRequest(req) && req.isApiCall;
107
+ const isUiIntegration = 'integrationCredentials' in req && !isApiCall;
108
+ if (isUiIntegration) {
107
109
  const html = (0, jsx_renderer_1.renderJSXOnClient)({ name: 'error', props: errorMessage });
108
110
  res.setHeader('Content-Type', 'text/html; charset=utf-8');
109
111
  res.send(html);
@@ -25,6 +25,7 @@ export declare class AppModuleError extends Error {
25
25
  data: any;
26
26
  appData: any;
27
27
  isAxiosError: boolean;
28
+ code?: number;
28
29
  constructor(error: CustomAxiosError | Error | string, data?: any);
29
30
  }
30
31
  export declare class AppUserModuleError extends AppModuleError {
@@ -197,6 +197,7 @@ function getErrorMessage(err) {
197
197
  }
198
198
  class AppModuleError extends Error {
199
199
  constructor(error, data) {
200
+ var _a;
200
201
  super(typeof error === 'string' ? error : error.message);
201
202
  this.isAxiosError = false;
202
203
  this.name = 'AppModuleError';
@@ -209,6 +210,12 @@ class AppModuleError extends Error {
209
210
  }
210
211
  if (isAxiosError(error)) {
211
212
  this.isAxiosError = true;
213
+ // Extract HTTP status code from axios error
214
+ this.code = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) || error.status;
215
+ }
216
+ else if (error.code && typeof error.code === 'number') {
217
+ // If error already has a numeric code property (e.g., CodeError)
218
+ this.code = error.code;
212
219
  }
213
220
  }
214
221
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
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",
@@ -10,15 +10,20 @@
10
10
  "import": "./out/index.js",
11
11
  "types": "./out/index.d.ts"
12
12
  },
13
- "./functions/crowdin": {
14
- "require": "./out/util/app-functions/crowdin.js",
15
- "import": "./out/util/app-functions/crowdin.js",
16
- "types": "./out/util/app-functions/crowdin.d.ts"
13
+ "./functions/*": {
14
+ "require": "./out/util/app-functions/*.js",
15
+ "import": "./out/util/app-functions/*.js",
16
+ "types": "./out/util/app-functions/*.d.ts"
17
17
  },
18
- "./functions/token": {
19
- "require": "./out/util/app-functions/token.js",
20
- "import": "./out/util/app-functions/token.js",
21
- "types": "./out/util/app-functions/token.d.ts"
18
+ "./out/*": {
19
+ "require": "./out/*.js",
20
+ "import": "./out/*.js",
21
+ "types": "./out/*.d.ts"
22
+ },
23
+ "./modules/*": {
24
+ "require": "./out/modules/*/types.js",
25
+ "import": "./out/modules/*/types.js",
26
+ "types": "./out/modules/*/types.d.ts"
22
27
  }
23
28
  },
24
29
  "scripts": {