@crowdin/app-project-module 0.51.2 → 0.51.4

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.
@@ -60,6 +60,7 @@ function handle(config, optional = false, checkSubscriptionExpiration = true) {
60
60
  var _a;
61
61
  const jwtToken = getToken(req);
62
62
  if (!jwtToken) {
63
+ (0, logger_1.temporaryErrorDebug)('Access denied: crowdin-client', req);
63
64
  return res.status(403).send({ error: 'Access denied' });
64
65
  }
65
66
  try {
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const storage_1 = require("../storage");
13
13
  const util_1 = require("../util");
14
14
  const connection_1 = require("../util/connection");
15
+ const logger_1 = require("../util/logger");
15
16
  function handle(config, integration, optional = false) {
16
17
  return (0, util_1.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
17
18
  const clientId = req.crowdinContext.clientId;
@@ -22,6 +23,7 @@ function handle(config, integration, optional = false) {
22
23
  if (optional) {
23
24
  return next();
24
25
  }
26
+ (0, logger_1.temporaryErrorDebug)('Access denied: integration-credentials', req);
25
27
  return res.status(403).send({ error: 'Access denied' });
26
28
  }
27
29
  if (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.config) {
@@ -26,6 +26,7 @@ function handle(config, allowUnauthorized = false) {
26
26
  }
27
27
  const jwtToken = req.query.jwtToken;
28
28
  if (!jwtToken) {
29
+ (0, logger_1.temporaryErrorDebug)('Access denied: ui-module', req);
29
30
  return res.status(403).send({ error: 'Access denied' });
30
31
  }
31
32
  (0, logger_1.log)('Validating jwt token from incoming request');
@@ -78,6 +78,7 @@ function handle(config, integration) {
78
78
  provider: types_1.Provider.CROWDIN,
79
79
  });
80
80
  if (!crowdinClient) {
81
+ (0, logger_1.temporaryErrorDebug)('Access denied: crowdin-webhooks', req);
81
82
  return res.status(403).send({ error: 'Access denied' });
82
83
  }
83
84
  if (!syncSettings) {
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const util_1 = require("../../../util");
13
13
  const webhooks_1 = require("../util/webhooks");
14
14
  const types_1 = require("../types");
15
+ const logger_1 = require("../../../util/logger");
15
16
  function handle(config, integration) {
16
17
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
17
18
  var _a, _b;
@@ -25,6 +26,7 @@ function handle(config, integration) {
25
26
  provider: types_1.Provider.INTEGRATION,
26
27
  });
27
28
  if (!webhookData.crowdinClient) {
29
+ (0, logger_1.temporaryErrorDebug)('Access denied: integration-webhooks !webhookData.crowdinClient', req);
28
30
  return res.status(403).send({ error: 'Access denied' });
29
31
  }
30
32
  if (!webhookData.syncSettings) {
@@ -34,6 +36,7 @@ function handle(config, integration) {
34
36
  res.send({});
35
37
  }
36
38
  else {
39
+ (0, logger_1.temporaryErrorDebug)('Access denied: integration-webhooks !webhookUrlParam', req);
37
40
  return res.status(403).send({ error: 'Access denied' });
38
41
  }
39
42
  }));
@@ -18,6 +18,10 @@ const cron_1 = require("../util/cron");
18
18
  const snapshot_1 = require("../util/snapshot");
19
19
  const files_1 = require("../util/files");
20
20
  const job_1 = require("../util/job");
21
+ function checkAutoSyncSettings(integration, appSettings, provider) {
22
+ var _a;
23
+ return !!(!integration.webhooks && ((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[provider]) && appSettings[`new-${provider}-files`]);
24
+ }
21
25
  function handle(config, integration) {
22
26
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
23
27
  const { files, provider, expandIntegrationFolders } = req.body;
@@ -29,7 +33,6 @@ function handle(config, integration) {
29
33
  payload: req.body,
30
34
  res,
31
35
  jobCallback: () => __awaiter(this, void 0, void 0, function* () {
32
- var _a;
33
36
  if (Array.isArray(expandIntegrationFolders) && expandIntegrationFolders.length) {
34
37
  const allFiles = (yield (0, files_1.expandFilesTree)(expandIntegrationFolders, req, integration)).map((node) => ({
35
38
  id: node.id,
@@ -56,7 +59,7 @@ function handle(config, integration) {
56
59
  });
57
60
  }
58
61
  const appSettings = req.integrationSettings || {};
59
- if (((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[provider]) && appSettings[`new-${provider}-files`]) {
62
+ if (checkAutoSyncSettings(integration, appSettings, provider)) {
60
63
  yield (0, snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, provider);
61
64
  }
62
65
  }),