@crowdin/app-project-module 0.43.1 → 0.45.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 (193) hide show
  1. package/out/index.d.ts +3 -3
  2. package/out/index.js +103 -219
  3. package/out/middlewares/crowdin-client.d.ts +1 -1
  4. package/out/middlewares/crowdin-client.js +3 -2
  5. package/out/middlewares/integration-credentials.d.ts +3 -2
  6. package/out/middlewares/render-ui-module.d.ts +2 -2
  7. package/out/middlewares/ui-module.d.ts +2 -2
  8. package/out/middlewares/ui-module.js +5 -1
  9. package/out/{util → modules}/api/api.d.ts +3 -2
  10. package/out/{util → modules}/api/api.js +22 -22
  11. package/out/modules/api/index.d.ts +6 -0
  12. package/out/modules/api/index.js +14 -0
  13. package/out/modules/api/types.d.ts +20 -0
  14. package/out/modules/api/types.js +11 -0
  15. package/out/modules/context-menu/index.d.ts +6 -0
  16. package/out/modules/context-menu/index.js +17 -0
  17. package/out/modules/context-menu/types.d.ts +27 -0
  18. package/out/modules/context-menu/types.js +18 -0
  19. package/out/{handlers/custom-mt → modules/custom-mt/handlers}/translate.d.ts +2 -1
  20. package/out/{handlers/custom-mt → modules/custom-mt/handlers}/translate.js +2 -2
  21. package/out/modules/custom-mt/index.d.ts +6 -0
  22. package/out/modules/custom-mt/index.js +17 -0
  23. package/out/modules/custom-mt/types.d.ts +22 -0
  24. package/out/modules/custom-mt/types.js +2 -0
  25. package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/get-languages-list.d.ts +2 -1
  26. package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/get-languages-list.js +2 -2
  27. package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/spell-check.d.ts +2 -1
  28. package/out/{handlers/custom-spell-check → modules/custom-spell-check/handlers}/spell-check.js +5 -3
  29. package/out/modules/custom-spell-check/index.d.ts +6 -0
  30. package/out/modules/custom-spell-check/index.js +32 -0
  31. package/out/modules/custom-spell-check/types.d.ts +56 -0
  32. package/out/modules/custom-spell-check/types.js +2 -0
  33. package/out/modules/editor-right-panel/index.d.ts +6 -0
  34. package/out/modules/editor-right-panel/index.js +17 -0
  35. package/out/modules/editor-right-panel/types.d.ts +7 -0
  36. package/out/modules/editor-right-panel/types.js +2 -0
  37. package/out/modules/editor-themes/index.d.ts +6 -0
  38. package/out/modules/editor-themes/index.js +11 -0
  39. package/out/modules/editor-themes/types.d.ts +17 -0
  40. package/out/modules/editor-themes/types.js +2 -0
  41. package/out/{handlers/file-processing → modules/file-processing/handlers}/custom-file-format.d.ts +2 -1
  42. package/out/{handlers/file-processing → modules/file-processing/handlers}/custom-file-format.js +5 -5
  43. package/out/modules/file-processing/handlers/file-download.d.ts +5 -0
  44. package/out/{handlers/file-processing → modules/file-processing/handlers}/file-download.js +2 -2
  45. package/out/{handlers/file-processing → modules/file-processing/handlers}/pre-post-process.d.ts +2 -1
  46. package/out/{handlers/file-processing → modules/file-processing/handlers}/pre-post-process.js +8 -8
  47. package/out/modules/file-processing/index.d.ts +22 -0
  48. package/out/modules/file-processing/index.js +57 -0
  49. package/out/modules/file-processing/types.d.ts +133 -0
  50. package/out/modules/file-processing/types.js +12 -0
  51. package/out/modules/file-processing/util/defaults.d.ts +3 -0
  52. package/out/modules/file-processing/util/defaults.js +30 -0
  53. package/out/modules/file-processing/util/files.d.ts +6 -0
  54. package/out/modules/file-processing/util/files.js +47 -0
  55. package/out/{handlers/integration/crowdin-project.d.ts → modules/form-data-display.d.ts} +1 -1
  56. package/out/modules/form-data-save.d.ts +4 -0
  57. package/out/modules/install.d.ts +4 -0
  58. package/out/{handlers → modules}/install.js +3 -3
  59. package/out/{handlers/integration → modules/integration/handlers}/crowdin-file-progress.d.ts +2 -1
  60. package/out/{handlers/integration → modules/integration/handlers}/crowdin-file-progress.js +2 -2
  61. package/out/modules/integration/handlers/crowdin-files.d.ts +5 -0
  62. package/out/{handlers/integration → modules/integration/handlers}/crowdin-files.js +3 -3
  63. package/out/modules/integration/handlers/crowdin-project.d.ts +4 -0
  64. package/out/{handlers/integration → modules/integration/handlers}/crowdin-project.js +1 -1
  65. package/out/modules/integration/handlers/crowdin-update.d.ts +5 -0
  66. package/out/{handlers/integration → modules/integration/handlers}/crowdin-update.js +9 -9
  67. package/out/modules/integration/handlers/crowdin-webhook.d.ts +5 -0
  68. package/out/{handlers/integration → modules/integration/handlers}/crowdin-webhook.js +19 -8
  69. package/out/modules/integration/handlers/integration-data.d.ts +4 -0
  70. package/out/{handlers/integration → modules/integration/handlers}/integration-data.js +5 -5
  71. package/out/{handlers/integration → modules/integration/handlers}/integration-login.d.ts +2 -1
  72. package/out/{handlers/integration → modules/integration/handlers}/integration-login.js +3 -3
  73. package/out/modules/integration/handlers/integration-logout.d.ts +5 -0
  74. package/out/{handlers/integration → modules/integration/handlers}/integration-logout.js +14 -7
  75. package/out/modules/integration/handlers/integration-update.d.ts +5 -0
  76. package/out/{handlers/integration → modules/integration/handlers}/integration-update.js +9 -8
  77. package/out/modules/integration/handlers/integration-webhook.d.ts +5 -0
  78. package/out/{handlers/integration → modules/integration/handlers}/integration-webhook.js +9 -4
  79. package/out/modules/integration/handlers/job-cancel.d.ts +3 -0
  80. package/out/{handlers/integration → modules/integration/handlers}/job-cancel.js +4 -4
  81. package/out/modules/integration/handlers/job-info.d.ts +3 -0
  82. package/out/{handlers/integration → modules/integration/handlers}/job-info.js +4 -4
  83. package/out/modules/integration/handlers/main.d.ts +5 -0
  84. package/out/{handlers/integration → modules/integration/handlers}/main.js +5 -5
  85. package/out/modules/integration/handlers/oauth-login.d.ts +5 -0
  86. package/out/{handlers/integration → modules/integration/handlers}/oauth-login.js +3 -3
  87. package/out/{handlers/integration → modules/integration/handlers}/oauth-url.d.ts +2 -1
  88. package/out/{handlers/integration → modules/integration/handlers}/oauth-url.js +2 -2
  89. package/out/modules/integration/handlers/settings-save.d.ts +5 -0
  90. package/out/{handlers/integration → modules/integration/handlers}/settings-save.js +28 -11
  91. package/out/modules/integration/handlers/settings.d.ts +3 -0
  92. package/out/{handlers/integration → modules/integration/handlers}/settings.js +1 -1
  93. package/out/{handlers/integration → modules/integration/handlers}/subscription-info.d.ts +1 -1
  94. package/out/{handlers/integration → modules/integration/handlers}/subscription-info.js +2 -2
  95. package/out/modules/integration/handlers/sync-settings-save.d.ts +5 -0
  96. package/out/{handlers/integration → modules/integration/handlers}/sync-settings-save.js +16 -8
  97. package/out/modules/integration/handlers/sync-settings.d.ts +3 -0
  98. package/out/{handlers/integration → modules/integration/handlers}/sync-settings.js +2 -2
  99. package/out/modules/integration/handlers/user-errors.d.ts +3 -0
  100. package/out/{handlers/integration → modules/integration/handlers}/user-errors.js +2 -2
  101. package/out/modules/integration/index.d.ts +6 -0
  102. package/out/modules/integration/index.js +118 -0
  103. package/out/modules/integration/types.d.ts +435 -0
  104. package/out/modules/integration/types.js +19 -0
  105. package/out/modules/integration/util/cron.d.ts +27 -0
  106. package/out/{util → modules/integration/util}/cron.js +97 -28
  107. package/out/{util → modules/integration/util}/defaults.d.ts +2 -3
  108. package/out/{util → modules/integration/util}/defaults.js +1 -36
  109. package/out/modules/integration/util/files.d.ts +5 -0
  110. package/out/{util → modules/integration/util}/files.js +9 -40
  111. package/out/{util → modules/integration/util}/job.d.ts +1 -1
  112. package/out/{util → modules/integration/util}/job.js +11 -11
  113. package/out/{util/file-snapshot.d.ts → modules/integration/util/snapshot.d.ts} +2 -3
  114. package/out/{util/file-snapshot.js → modules/integration/util/snapshot.js} +6 -65
  115. package/out/{models/job.d.ts → modules/integration/util/types.d.ts} +14 -0
  116. package/out/modules/integration/util/webhooks.d.ts +48 -0
  117. package/out/{util → modules/integration/util}/webhooks.js +95 -49
  118. package/out/modules/manifest.d.ts +3 -0
  119. package/out/{handlers → modules}/manifest.js +22 -16
  120. package/out/modules/modal/index.d.ts +6 -0
  121. package/out/modules/modal/index.js +17 -0
  122. package/out/modules/organization-menu/index.d.ts +6 -0
  123. package/out/modules/organization-menu/index.js +18 -0
  124. package/out/modules/profile-resources-menu/index.d.ts +6 -0
  125. package/out/modules/profile-resources-menu/index.js +18 -0
  126. package/out/modules/project-menu/index.d.ts +6 -0
  127. package/out/modules/project-menu/index.js +17 -0
  128. package/out/modules/project-menu-crowdsource/index.d.ts +6 -0
  129. package/out/modules/project-menu-crowdsource/index.js +17 -0
  130. package/out/modules/project-reports/index.d.ts +6 -0
  131. package/out/modules/project-reports/index.js +18 -0
  132. package/out/modules/project-tools/index.d.ts +6 -0
  133. package/out/modules/project-tools/index.js +18 -0
  134. package/out/modules/subscription-paid.d.ts +3 -0
  135. package/out/{handlers → modules}/subscription-paid.js +2 -2
  136. package/out/modules/uninstall.d.ts +4 -0
  137. package/out/{handlers → modules}/uninstall.js +6 -2
  138. package/out/storage/index.d.ts +5 -3
  139. package/out/storage/mysql.d.ts +4 -2
  140. package/out/storage/mysql.js +3 -3
  141. package/out/storage/postgre.d.ts +4 -2
  142. package/out/storage/postgre.js +3 -3
  143. package/out/storage/sqlite.d.ts +4 -2
  144. package/out/storage/sqlite.js +3 -3
  145. package/out/storage/types.d.ts +9 -0
  146. package/out/storage/types.js +2 -0
  147. package/out/types.d.ts +374 -0
  148. package/out/types.js +59 -0
  149. package/out/util/connection.d.ts +2 -9
  150. package/out/util/connection.js +54 -150
  151. package/out/util/handlebars.d.ts +1 -0
  152. package/out/util/handlebars.js +34 -0
  153. package/out/util/index.d.ts +2 -2
  154. package/out/util/index.js +6 -6
  155. package/out/util/logger.d.ts +2 -2
  156. package/out/util/subscription.d.ts +9 -0
  157. package/out/util/subscription.js +111 -0
  158. package/package.json +1 -1
  159. package/out/handlers/file-processing/file-download.d.ts +0 -4
  160. package/out/handlers/form-data-display.d.ts +0 -3
  161. package/out/handlers/form-data-save.d.ts +0 -3
  162. package/out/handlers/install.d.ts +0 -4
  163. package/out/handlers/integration/crowdin-files.d.ts +0 -4
  164. package/out/handlers/integration/crowdin-update.d.ts +0 -4
  165. package/out/handlers/integration/crowdin-webhook.d.ts +0 -4
  166. package/out/handlers/integration/integration-data.d.ts +0 -4
  167. package/out/handlers/integration/integration-logout.d.ts +0 -4
  168. package/out/handlers/integration/integration-update.d.ts +0 -4
  169. package/out/handlers/integration/integration-webhook.d.ts +0 -4
  170. package/out/handlers/integration/job-cancel.d.ts +0 -3
  171. package/out/handlers/integration/job-info.d.ts +0 -3
  172. package/out/handlers/integration/main.d.ts +0 -4
  173. package/out/handlers/integration/oauth-login.d.ts +0 -4
  174. package/out/handlers/integration/settings-save.d.ts +0 -4
  175. package/out/handlers/integration/settings.d.ts +0 -3
  176. package/out/handlers/integration/sync-settings-save.d.ts +0 -4
  177. package/out/handlers/integration/sync-settings.d.ts +0 -3
  178. package/out/handlers/integration/user-errors.d.ts +0 -3
  179. package/out/handlers/manifest.d.ts +0 -3
  180. package/out/handlers/subscription-paid.d.ts +0 -3
  181. package/out/handlers/uninstall.d.ts +0 -4
  182. package/out/models/index.d.ts +0 -1088
  183. package/out/models/index.js +0 -106
  184. package/out/util/cron.d.ts +0 -7
  185. package/out/util/files.d.ts +0 -9
  186. package/out/util/webhooks.d.ts +0 -28
  187. /package/out/{util → modules}/api/base.d.ts +0 -0
  188. /package/out/{util → modules}/api/base.js +0 -0
  189. /package/out/{util → modules}/api/components.d.ts +0 -0
  190. /package/out/{util → modules}/api/components.js +0 -0
  191. /package/out/{handlers → modules}/form-data-display.js +0 -0
  192. /package/out/{handlers → modules}/form-data-save.js +0 -0
  193. /package/out/{models/job.js → modules/integration/util/types.js} +0 -0
@@ -35,15 +35,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.listenQueueMessage = exports.updateCrowdinFromWebhookRequest = exports.prepareWebhookData = exports.unregisterAllCrowdinWebhooks = exports.unregisterCrowdinWebhooks = exports.updateCrowdinWebhooks = exports.registerCrowdinWebhook = exports.getAllCrowdinProjectWebhooks = exports.getCrowdinProjectWebhook = exports.unregisterWebhooks = exports.registerWebhooks = exports.makeCrowdinWebhookUrl = exports.decodedUrlParam = exports.encodedUrlParam = exports.HookEvents = void 0;
38
+ exports.listenQueueMessage = exports.updateCrowdinFromWebhookRequest = exports.prepareWebhookData = exports.unregisterAllCrowdinWebhooks = exports.unregisterWebhooks = exports.registerWebhooks = exports.HookEvents = void 0;
39
39
  const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
40
40
  const amqplib_1 = __importDefault(require("amqplib"));
41
- const models_1 = require("../models");
42
- const storage_1 = require("../storage");
43
- const connection_1 = require("./connection");
41
+ const types_1 = require("../types");
42
+ const storage_1 = require("../../../storage");
43
+ const connection_1 = require("../../../util/connection");
44
44
  const defaults_1 = require("./defaults");
45
- const index_1 = require("./index");
46
- const logger_1 = require("./logger");
45
+ const index_1 = require("../../../util/index");
46
+ const logger_1 = require("../../../util/logger");
47
47
  const prefetchCount = 20;
48
48
  const forceProcessDelay = 5000;
49
49
  exports.HookEvents = {
@@ -58,7 +58,7 @@ const HookConditionEvents = {
58
58
  TRANSLATED: [exports.HookEvents.fileTranslated, exports.HookEvents.fileDeleted],
59
59
  APPROVED: [exports.HookEvents.fileApproved, exports.HookEvents.fileDeleted],
60
60
  };
61
- function encodedUrlParam(config, integration, crowdinContext) {
61
+ function encodedUrlParam({ config, crowdinContext, integration, }) {
62
62
  var _a;
63
63
  const params = {
64
64
  projectId: +crowdinContext.jwtPayload.context.project_id,
@@ -68,44 +68,61 @@ function encodedUrlParam(config, integration, crowdinContext) {
68
68
  const encryptedParams = (0, index_1.encryptData)(config, JSON.stringify(params));
69
69
  return `${(_a = integration.webhooks) === null || _a === void 0 ? void 0 : _a.urlParam}=${encodeURIComponent(encryptedParams)}`;
70
70
  }
71
- exports.encodedUrlParam = encodedUrlParam;
72
71
  function decodedUrlParam(config, data) {
73
72
  const params = (0, index_1.decryptData)(config, data);
74
73
  return JSON.parse(params);
75
74
  }
76
- exports.decodedUrlParam = decodedUrlParam;
77
- function makeCrowdinWebhookUrl(config, integration, crowdinContext) {
75
+ function makeCrowdinWebhookUrl({ config, crowdinContext, integration, }) {
78
76
  var _a;
79
- const urlParam = encodedUrlParam(config, integration, crowdinContext);
77
+ const urlParam = encodedUrlParam({ config, integration, crowdinContext });
80
78
  return (`${config.baseUrl}${((_a = integration.webhooks) === null || _a === void 0 ? void 0 : _a.crowdinWebhookUrl) ? integration.webhooks.crowdinWebhookUrl : '/api/crowdin/webhook'}` + `?${urlParam}`);
81
79
  }
82
- exports.makeCrowdinWebhookUrl = makeCrowdinWebhookUrl;
83
- function registerWebhooks(config, integration, client, crowdinContext, apiCredentials, appSettings) {
80
+ function registerWebhooks({ config, apiCredentials, appSettings, client, crowdinContext, integration, }) {
84
81
  var _a, _b;
85
82
  return __awaiter(this, void 0, void 0, function* () {
86
- const isWebhookSync = Number(appSettings.schedule) !== models_1.SyncSchedule.DISABLED;
83
+ const isWebhookSync = Number(appSettings.schedule) !== types_1.SyncSchedule.DISABLED;
87
84
  const projectId = crowdinContext.jwtPayload.context.project_id;
88
- const urlParam = encodedUrlParam(config, integration, crowdinContext);
85
+ const urlParam = encodedUrlParam({ config, integration, crowdinContext });
89
86
  if ((_a = integration.webhooks) === null || _a === void 0 ? void 0 : _a.crowdinWebhooks) {
90
87
  yield integration.webhooks.crowdinWebhooks(client, projectId, isWebhookSync, appSettings);
91
88
  }
92
89
  else {
93
90
  const webhookName = `${config.name} application hook ${crowdinContext.jwtPayload.sub}`;
94
- const webhookUrl = makeCrowdinWebhookUrl(config, integration, crowdinContext);
95
- const syncCondition = models_1.SyncCondition[Number(appSettings.condition)];
91
+ const webhookUrl = makeCrowdinWebhookUrl({
92
+ config,
93
+ integration,
94
+ crowdinContext,
95
+ });
96
+ const syncCondition = types_1.SyncCondition[Number(appSettings.condition)];
96
97
  const events = [...HookConditionEvents[syncCondition]];
97
- const webhook = yield getCrowdinProjectWebhook(config, client, projectId, webhookName);
98
+ const webhook = yield getCrowdinProjectWebhook({
99
+ client,
100
+ projectId,
101
+ name: webhookName,
102
+ });
98
103
  if (appSettings['new-crowdin-files']) {
99
104
  events.push(exports.HookEvents.fileAdded);
100
105
  }
101
106
  if (isWebhookSync && webhook) {
102
- yield updateCrowdinWebhooks(config, client, projectId, webhook, events, webhookUrl);
107
+ yield updateCrowdinWebhooks({
108
+ client,
109
+ projectId,
110
+ webhook,
111
+ events,
112
+ url: webhookUrl,
113
+ });
103
114
  }
104
115
  else if (isWebhookSync && !webhook) {
105
- yield registerCrowdinWebhook(config, webhookUrl, client, crowdinContext, events);
116
+ yield registerCrowdinWebhook({
117
+ config,
118
+ url: webhookUrl,
119
+ client,
120
+ crowdinContext,
121
+ events,
122
+ });
106
123
  }
107
124
  else if (!isWebhookSync && webhook) {
108
- yield unregisterCrowdinWebhooks(config, client, projectId, webhook);
125
+ yield unregisterCrowdinWebhooks({ client, projectId, webhook });
109
126
  }
110
127
  }
111
128
  if ((_b = integration.webhooks) === null || _b === void 0 ? void 0 : _b.integrationWebhooks) {
@@ -114,7 +131,7 @@ function registerWebhooks(config, integration, client, crowdinContext, apiCreden
114
131
  });
115
132
  }
116
133
  exports.registerWebhooks = registerWebhooks;
117
- function unregisterWebhooks(config, integration, client, crowdinContext, apiCredentials, appSettings) {
134
+ function unregisterWebhooks({ apiCredentials, appSettings, client, config, crowdinContext, integration, }) {
118
135
  var _a, _b;
119
136
  return __awaiter(this, void 0, void 0, function* () {
120
137
  if ((_a = integration.webhooks) === null || _a === void 0 ? void 0 : _a.crowdinWebhooks) {
@@ -122,32 +139,38 @@ function unregisterWebhooks(config, integration, client, crowdinContext, apiCred
122
139
  }
123
140
  else {
124
141
  const webhookName = `${config.name} application hook ${crowdinContext.jwtPayload.sub}`;
125
- const webhook = yield getCrowdinProjectWebhook(config, client, crowdinContext.jwtPayload.context.project_id, webhookName);
142
+ const webhook = yield getCrowdinProjectWebhook({
143
+ client,
144
+ projectId: crowdinContext.jwtPayload.context.project_id,
145
+ name: webhookName,
146
+ });
126
147
  if (webhook) {
127
- yield unregisterCrowdinWebhooks(config, client, crowdinContext.jwtPayload.context.project_id, webhook);
148
+ yield unregisterCrowdinWebhooks({
149
+ client,
150
+ projectId: crowdinContext.jwtPayload.context.project_id,
151
+ webhook,
152
+ });
128
153
  }
129
154
  }
130
155
  if ((_b = integration.webhooks) === null || _b === void 0 ? void 0 : _b.integrationWebhooks) {
131
- const urlParam = encodedUrlParam(config, integration, crowdinContext);
156
+ const urlParam = encodedUrlParam({ config, integration, crowdinContext });
132
157
  yield integration.webhooks.integrationWebhooks(apiCredentials, urlParam, false, appSettings);
133
158
  }
134
159
  });
135
160
  }
136
161
  exports.unregisterWebhooks = unregisterWebhooks;
137
- function getCrowdinProjectWebhook(config, client, projectId, name) {
162
+ function getCrowdinProjectWebhook({ client, name, projectId, }) {
138
163
  return __awaiter(this, void 0, void 0, function* () {
139
164
  const hooks = (yield client.webhooksApi.withFetchAll().listWebhooks(projectId)).data.map((e) => e.data);
140
165
  return hooks.find((h) => h.name === name);
141
166
  });
142
167
  }
143
- exports.getCrowdinProjectWebhook = getCrowdinProjectWebhook;
144
- function getAllCrowdinProjectWebhooks(config, client, projectId) {
168
+ function getAllCrowdinProjectWebhooks({ client, config, projectId, }) {
145
169
  return __awaiter(this, void 0, void 0, function* () {
146
170
  const hooks = (yield client.webhooksApi.withFetchAll().listWebhooks(projectId)).data.map((e) => e.data);
147
171
  return hooks.filter((h) => h.name.startsWith(`${config.name} application hook `));
148
172
  });
149
173
  }
150
- exports.getAllCrowdinProjectWebhooks = getAllCrowdinProjectWebhooks;
151
174
  function createPayload(events) {
152
175
  const payload = {};
153
176
  for (const event of events) {
@@ -160,7 +183,7 @@ function createPayload(events) {
160
183
  }
161
184
  return payload;
162
185
  }
163
- function registerCrowdinWebhook(config, url, client, crowdinContext, events) {
186
+ function registerCrowdinWebhook({ client, config, crowdinContext, events, url, }) {
164
187
  return __awaiter(this, void 0, void 0, function* () {
165
188
  const name = `${config.name} application hook ${crowdinContext.jwtPayload.sub}`;
166
189
  const payload = createPayload(events);
@@ -174,8 +197,7 @@ function registerCrowdinWebhook(config, url, client, crowdinContext, events) {
174
197
  });
175
198
  });
176
199
  }
177
- exports.registerCrowdinWebhook = registerCrowdinWebhook;
178
- function updateCrowdinWebhooks(config, client, projectId, webhook, events, url) {
200
+ function updateCrowdinWebhooks({ client, events, projectId, url, webhook, }) {
179
201
  return __awaiter(this, void 0, void 0, function* () {
180
202
  const payload = createPayload(events);
181
203
  yield client.webhooksApi.editWebhook(projectId, webhook.id, [
@@ -197,14 +219,12 @@ function updateCrowdinWebhooks(config, client, projectId, webhook, events, url)
197
219
  ]);
198
220
  });
199
221
  }
200
- exports.updateCrowdinWebhooks = updateCrowdinWebhooks;
201
- function unregisterCrowdinWebhooks(config, client, projectId, webhook) {
222
+ function unregisterCrowdinWebhooks({ client, projectId, webhook, }) {
202
223
  return __awaiter(this, void 0, void 0, function* () {
203
224
  yield client.webhooksApi.deleteWebhook(projectId, webhook.id);
204
225
  });
205
226
  }
206
- exports.unregisterCrowdinWebhooks = unregisterCrowdinWebhooks;
207
- function unregisterAllCrowdinWebhooks(config, integration, crowdinId) {
227
+ function unregisterAllCrowdinWebhooks({ config, crowdinId, integration, }) {
208
228
  return __awaiter(this, void 0, void 0, function* () {
209
229
  if (integration.webhooks) {
210
230
  const crowdinCredentials = yield (0, storage_1.getStorage)().getCrowdinCredentials(crowdinId);
@@ -213,15 +233,25 @@ function unregisterAllCrowdinWebhooks(config, integration, crowdinId) {
213
233
  const projectIds = credentials.map((c) => crowdinAppFunctions.getProjectId(c.id));
214
234
  const crowdinClient = yield (0, connection_1.prepareCrowdinClient)({ config, credentials: crowdinCredentials });
215
235
  yield Promise.all(projectIds.map((projectId) => __awaiter(this, void 0, void 0, function* () {
216
- const webhooks = yield getAllCrowdinProjectWebhooks(config, crowdinClient.client, projectId);
217
- yield Promise.all(webhooks.map((hook) => __awaiter(this, void 0, void 0, function* () { return yield unregisterCrowdinWebhooks(config, crowdinClient.client, projectId, hook); })));
236
+ const webhooks = yield getAllCrowdinProjectWebhooks({
237
+ config,
238
+ client: crowdinClient.client,
239
+ projectId,
240
+ });
241
+ yield Promise.all(webhooks.map((hook) => __awaiter(this, void 0, void 0, function* () {
242
+ return yield unregisterCrowdinWebhooks({
243
+ client: crowdinClient.client,
244
+ projectId,
245
+ webhook: hook,
246
+ });
247
+ })));
218
248
  })));
219
249
  }
220
250
  }
221
251
  });
222
252
  }
223
253
  exports.unregisterAllCrowdinWebhooks = unregisterAllCrowdinWebhooks;
224
- function prepareWebhookData(config, integration, webhookUrlParam, provider) {
254
+ function prepareWebhookData({ config, integration, provider, webhookUrlParam, }) {
225
255
  return __awaiter(this, void 0, void 0, function* () {
226
256
  let rootFolder = undefined;
227
257
  let syncSettings = null;
@@ -250,7 +280,7 @@ function prepareWebhookData(config, integration, webhookUrlParam, provider) {
250
280
  const preparedIntegrationCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
251
281
  if (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.config) {
252
282
  appSettings = JSON.parse(integrationConfig.config);
253
- const isWebhookSync = Number(appSettings.schedule) !== models_1.SyncSchedule.DISABLED;
283
+ const isWebhookSync = Number(appSettings.schedule) !== types_1.SyncSchedule.DISABLED;
254
284
  if (isWebhookSync) {
255
285
  syncSettings = (yield (0, storage_1.getStorage)().getSyncSettings(clientId, crowdinId, 'schedule', provider));
256
286
  rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, crowdinClient.client, projectId);
@@ -298,13 +328,13 @@ function updateCrowdinFromWebhookRequest(args) {
298
328
  });
299
329
  }
300
330
  exports.updateCrowdinFromWebhookRequest = updateCrowdinFromWebhookRequest;
301
- function listenQueueMessage(config, integration, queueUrl, queueName) {
331
+ function listenQueueMessage({ config, integration, queueName, queueUrl, }) {
302
332
  return __awaiter(this, void 0, void 0, function* () {
303
333
  try {
304
334
  const connection = yield amqplib_1.default.connect(queueUrl);
305
335
  connection.once('close', function () {
306
336
  setTimeout(() => {
307
- listenQueueMessage(config, integration, queueUrl, queueName);
337
+ listenQueueMessage({ config, integration, queueUrl, queueName });
308
338
  }, 3000);
309
339
  return;
310
340
  });
@@ -312,18 +342,19 @@ function listenQueueMessage(config, integration, queueUrl, queueName) {
312
342
  if (channel) {
313
343
  yield channel.assertQueue(queueName, { durable: true });
314
344
  yield channel.prefetch(prefetchCount);
315
- yield channel.consume(queueName, consumer(channel, config, integration), { noAck: false });
345
+ const onMessage = consumer({ channel, config, integration });
346
+ yield channel.consume(queueName, onMessage, { noAck: false });
316
347
  }
317
348
  }
318
349
  catch (e) {
319
350
  setTimeout(() => {
320
- listenQueueMessage(config, integration, queueUrl, queueName);
351
+ listenQueueMessage({ config, integration, queueUrl, queueName });
321
352
  }, 3000);
322
353
  }
323
354
  });
324
355
  }
325
356
  exports.listenQueueMessage = listenQueueMessage;
326
- function consumer(channel, config, integration) {
357
+ function consumer({ channel, config, integration, }) {
327
358
  let messagesCounter = 0;
328
359
  let webhooksInfo = {};
329
360
  let webhooksData = [];
@@ -350,7 +381,12 @@ function consumer(channel, config, integration) {
350
381
  webhooksInfo[clientId] = {};
351
382
  webhooksInfo[clientId].data = [data];
352
383
  webhooksInfo[clientId].integration = integration;
353
- webhooksData.push(prepareWebhookData(config, integration, webhookUrlParam, models_1.Provider.INTEGRATION).then((res) => {
384
+ webhooksData.push(prepareWebhookData({
385
+ config,
386
+ integration,
387
+ webhookUrlParam,
388
+ provider: types_1.Provider.INTEGRATION,
389
+ }).then((res) => {
354
390
  webhooksInfo[clientId].webhookData = res;
355
391
  }));
356
392
  }
@@ -360,13 +396,23 @@ function consumer(channel, config, integration) {
360
396
  if (messagesCounter < prefetchCount) {
361
397
  // if all messages are not received, wait 5 seconds to force process messages
362
398
  timeoutId = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
363
- yield processMessages(webhooksData, webhooksInfo, channel, msg);
399
+ yield processMessages({
400
+ webhooksData,
401
+ webhooksInfo,
402
+ channel,
403
+ msg,
404
+ });
364
405
  resetStateVariables();
365
406
  }), forceProcessDelay);
366
407
  return;
367
408
  }
368
409
  clearTimeout(timeoutId);
369
- yield processMessages(webhooksData, webhooksInfo, channel, msg);
410
+ yield processMessages({
411
+ webhooksData,
412
+ webhooksInfo,
413
+ channel,
414
+ msg,
415
+ });
370
416
  resetStateVariables();
371
417
  }
372
418
  catch (e) {
@@ -375,7 +421,7 @@ function consumer(channel, config, integration) {
375
421
  });
376
422
  };
377
423
  }
378
- function processMessages(webhooksData, webhooksInfo, channel, msg) {
424
+ function processMessages({ channel, msg, webhooksData, webhooksInfo, }) {
379
425
  return __awaiter(this, void 0, void 0, function* () {
380
426
  yield Promise.all(webhooksData);
381
427
  for (const { data, integration, webhookData } of Object.values(webhooksInfo)) {
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../types';
3
+ export default function handle(config: Config | UnauthorizedConfig): (_req: Request, res: Response) => void;
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const models_1 = require("../models");
3
+ const types_1 = require("../types");
4
4
  const util_1 = require("../util");
5
- const api_1 = require("../util/api/api");
6
- const connection_1 = require("../util/connection");
5
+ const subscription_1 = require("../util/subscription");
6
+ const api_1 = require("./api/api");
7
+ function normalizeEnvironments(environments) {
8
+ if (Array.isArray(environments)) {
9
+ return environments;
10
+ }
11
+ return [environments];
12
+ }
7
13
  function handle(config) {
8
14
  const modules = {};
9
15
  if (config.projectIntegration) {
@@ -14,7 +20,7 @@ function handle(config) {
14
20
  description: config.description,
15
21
  logo: (0, util_1.getLogoUrl)(config.projectIntegration, '/integration'),
16
22
  url: '/',
17
- environments: config.projectIntegration.environments,
23
+ environments: normalizeEnvironments(config.projectIntegration.environments),
18
24
  },
19
25
  ];
20
26
  }
@@ -76,7 +82,7 @@ function handle(config) {
76
82
  name: config.name,
77
83
  logo: (0, util_1.getLogoUrl)(config.customMT, '/mt'),
78
84
  url: '/translate',
79
- environments: config.customMT.environments,
85
+ environments: normalizeEnvironments(config.customMT.environments),
80
86
  withContext: !!config.customMT.withContext,
81
87
  },
82
88
  ];
@@ -98,7 +104,7 @@ function handle(config) {
98
104
  name: config.profileResourcesMenu.name || config.name,
99
105
  url: '/resources/' + (config.profileResourcesMenu.fileName || 'index.html'),
100
106
  icon: (0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'),
101
- environments: config.profileResourcesMenu.environments,
107
+ environments: normalizeEnvironments(config.profileResourcesMenu.environments),
102
108
  },
103
109
  ];
104
110
  }
@@ -109,7 +115,7 @@ function handle(config) {
109
115
  name: config.editorRightPanel.name || config.name,
110
116
  url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'),
111
117
  modes: config.editorRightPanel.modes,
112
- environments: config.editorRightPanel.environments,
118
+ environments: normalizeEnvironments(config.editorRightPanel.environments),
113
119
  },
114
120
  ];
115
121
  }
@@ -121,7 +127,7 @@ function handle(config) {
121
127
  logo: (0, util_1.getLogoUrl)(config.editorThemes, '/editor-themes'),
122
128
  styles: config.editorThemes.styles,
123
129
  modes: config.editorThemes.modes,
124
- environments: config.editorThemes.environments,
130
+ environments: normalizeEnvironments(config.editorThemes.environments),
125
131
  },
126
132
  ];
127
133
  }
@@ -131,7 +137,7 @@ function handle(config) {
131
137
  key: config.identifier + '-project-menu',
132
138
  name: config.projectMenu.name || config.name,
133
139
  url: '/project-menu/' + (config.projectMenu.fileName || 'index.html'),
134
- environments: config.projectMenu.environments,
140
+ environments: normalizeEnvironments(config.projectMenu.environments),
135
141
  },
136
142
  ];
137
143
  }
@@ -152,7 +158,7 @@ function handle(config) {
152
158
  description: config.description,
153
159
  logo: (0, util_1.getLogoUrl)(config.projectTools, '/tools'),
154
160
  url: '/tools/' + (config.projectTools.fileName || 'index.html'),
155
- environments: config.projectTools.environments,
161
+ environments: normalizeEnvironments(config.projectTools.environments),
156
162
  },
157
163
  ];
158
164
  }
@@ -173,7 +179,7 @@ function handle(config) {
173
179
  key: config.identifier + '-modal',
174
180
  name: config.modal.name || config.name,
175
181
  url: config.modal.url || '/modal/' + (config.modal.fileName || 'index.html'),
176
- environments: config.modal.environments,
182
+ environments: normalizeEnvironments(config.modal.environments),
177
183
  },
178
184
  ];
179
185
  }
@@ -191,7 +197,7 @@ function handle(config) {
191
197
  }
192
198
  : {})), { url: '/context/' + (config.contextMenu.fileName || 'index.html') }),
193
199
  signaturePatterns: config.contextMenu.signaturePatterns,
194
- environments: config.contextMenu.environments,
200
+ environments: normalizeEnvironments(config.contextMenu.environments),
195
201
  },
196
202
  ];
197
203
  }
@@ -201,21 +207,21 @@ function handle(config) {
201
207
  if (config.customSpellchecker) {
202
208
  const uiModule = config.customSpellchecker.settingsUiModule;
203
209
  modules['custom-spellchecker'] = [
204
- Object.assign({ key: config.identifier + '-spellchecker', name: config.customSpellchecker.name || config.name, description: config.customSpellchecker.description || config.description, listSupportedLanguagesUrl: '/languages', checkSpellingUrl: '/spellcheck', environments: config.customSpellchecker.environments }, (uiModule ? { url: '/settings/' + (uiModule.fileName || 'index.html') } : {})),
210
+ Object.assign({ key: config.identifier + '-spellchecker', name: config.customSpellchecker.name || config.name, description: config.customSpellchecker.description || config.description, listSupportedLanguagesUrl: '/languages', checkSpellingUrl: '/spellcheck', environments: normalizeEnvironments(config.customSpellchecker.environments) }, (uiModule ? { url: '/settings/' + (uiModule.fileName || 'index.html') } : {})),
205
211
  ];
206
212
  }
207
213
  const events = {
208
214
  installed: '/installed',
209
215
  uninstall: '/uninstall',
210
216
  };
211
- if (!(0, connection_1.isAppFree)(config)) {
217
+ if (!(0, subscription_1.isAppFree)(config)) {
212
218
  events['subscription_paid'] = '/subscription-paid';
213
219
  }
214
220
  return (_req, res) => {
215
221
  const manifest = Object.assign(Object.assign({ identifier: config.identifier, name: config.name, logo: (0, util_1.getLogoUrl)(), baseUrl: config.baseUrl, authentication: {
216
- type: config.authenticationType || models_1.AuthenticationType.APP,
222
+ type: config.authenticationType || types_1.AuthenticationType.APP,
217
223
  clientId: config.clientId,
218
- }, events, scopes: config.scopes ? config.scopes : [models_1.Scope.PROJECTS] }, (config.defaultPermissions && { default_permissions: config.defaultPermissions })), { modules });
224
+ }, events, scopes: config.scopes ? config.scopes : [types_1.Scope.PROJECTS] }, (config.defaultPermissions && { default_permissions: config.defaultPermissions })), { modules });
219
225
  res.send(manifest);
220
226
  };
221
227
  }
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ var _a, _b;
12
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
13
+ if (((_a = config.modal) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.modal) === null || _b === void 0 ? void 0 : _b.formSchema)) {
14
+ app.use('/modal', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.modal));
15
+ }
16
+ }
17
+ exports.register = register;
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ if (!config.organizationMenu) {
12
+ return;
13
+ }
14
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
+ app.get((0, util_1.getLogoUrl)(config.organizationMenu, '/resources'), (req, res) => { var _a; return res.sendFile(((_a = config.organizationMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
16
+ app.use('/resources', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.organizationMenu));
17
+ }
18
+ exports.register = register;
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ if (!config.profileResourcesMenu) {
12
+ return;
13
+ }
14
+ app.get((0, util_1.getLogoUrl)(config.profileResourcesMenu, '/resources'), (req, res) => { var _a; return res.sendFile(((_a = config.profileResourcesMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
15
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
16
+ app.use('/resources', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.profileResourcesMenu));
17
+ }
18
+ exports.register = register;
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ if (!config.projectMenu) {
12
+ return;
13
+ }
14
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
+ app.use('/project-menu', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.projectMenu));
16
+ }
17
+ exports.register = register;
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ if (!config.projectMenuCrowdsource) {
12
+ return;
13
+ }
14
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
+ app.use('/project-menu-crowdsource', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.projectMenuCrowdsource));
16
+ }
17
+ exports.register = register;
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ if (!config.projectReports) {
12
+ return;
13
+ }
14
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
+ app.get((0, util_1.getLogoUrl)(config.projectReports, '/reports'), (req, res) => { var _a; return res.sendFile(((_a = config.projectReports) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
16
+ app.use('/reports', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.projectReports));
17
+ }
18
+ exports.register = register;
@@ -0,0 +1,6 @@
1
+ import { Express } from 'express';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
+ export declare function register({ config, app }: {
4
+ config: Config | UnauthorizedConfig;
5
+ app: Express;
6
+ }): void;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.register = void 0;
7
+ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
+ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
+ const util_1 = require("../../util");
10
+ function register({ config, app }) {
11
+ if (!config.projectTools) {
12
+ return;
13
+ }
14
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
+ app.get((0, util_1.getLogoUrl)(config.projectTools, '/tools'), (req, res) => { var _a; return res.sendFile(((_a = config.projectTools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
16
+ app.use('/tools', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.projectTools));
17
+ }
18
+ exports.register = register;
@@ -0,0 +1,3 @@
1
+ /// <reference types="qs" />
2
+ import { Request, Response } from 'express';
3
+ export default function handle(): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;