@crowdin/app-project-module 0.106.0 → 0.107.0-cf-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 (161) hide show
  1. package/out/app-test/integration/get-integration-files.js +0 -1
  2. package/out/app-test/integration/mocks/mock-axios.js +0 -1
  3. package/out/app-test/integration/update-crowdin.js +0 -1
  4. package/out/app-test/integration/update-integration.js +0 -1
  5. package/out/index.d.ts +1 -0
  6. package/out/index.js +30 -12
  7. package/out/middlewares/crowdin-client.d.ts +1 -1
  8. package/out/middlewares/integration-credentials.d.ts +1 -1
  9. package/out/middlewares/integration-credentials.js +4 -1
  10. package/out/middlewares/render-ui-module.d.ts +3 -3
  11. package/out/middlewares/render-ui-module.js +9 -13
  12. package/out/middlewares/ui-module.d.ts +1 -1
  13. package/out/middlewares/ui-module.js +10 -1
  14. package/out/modules/about.d.ts +2 -1
  15. package/out/modules/about.js +10 -3
  16. package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
  17. package/out/modules/ai-prompt-provider/index.js +2 -2
  18. package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
  19. package/out/modules/ai-provider/handlers/chat-completions.js +0 -1
  20. package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
  21. package/out/modules/ai-provider/index.js +2 -2
  22. package/out/modules/ai-provider/types.d.ts +2 -2
  23. package/out/modules/ai-provider/util/index.js +0 -2
  24. package/out/modules/ai-request-processors/handler.d.ts +1 -1
  25. package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
  26. package/out/modules/ai-tools/index.js +1 -1
  27. package/out/modules/api/api.js +0 -1
  28. package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
  29. package/out/modules/auth-guard/index.js +1 -1
  30. package/out/modules/automation-action/handlers/execute.d.ts +1 -1
  31. package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
  32. package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
  33. package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
  34. package/out/modules/automation-action/index.js +1 -1
  35. package/out/modules/context-menu/index.js +2 -2
  36. package/out/modules/custom-mt/handlers/translate.d.ts +2 -2
  37. package/out/modules/custom-mt/handlers/translate.js +53 -4
  38. package/out/modules/custom-mt/index.js +6 -3
  39. package/out/modules/custom-mt/types.d.ts +14 -2
  40. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
  41. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
  42. package/out/modules/custom-spell-check/index.js +4 -4
  43. package/out/modules/editor-right-panel/index.js +1 -1
  44. package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
  45. package/out/modules/external-qa-check/index.js +2 -2
  46. package/out/modules/file-processing/handlers/custom-file-format.d.ts +7 -2
  47. package/out/modules/file-processing/handlers/custom-file-format.js +59 -19
  48. package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
  49. package/out/modules/file-processing/handlers/file-download.js +5 -0
  50. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
  51. package/out/modules/file-processing/handlers/pre-post-process.js +34 -14
  52. package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
  53. package/out/modules/file-processing/index.js +12 -2
  54. package/out/modules/file-processing/util/defaults.js +50 -6
  55. package/out/modules/file-processing/util/files.js +2 -1
  56. package/out/modules/form-data-display.d.ts +1 -1
  57. package/out/modules/form-data-save.d.ts +1 -1
  58. package/out/modules/install.d.ts +1 -1
  59. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
  60. package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
  61. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
  62. package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
  63. package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
  64. package/out/modules/integration/handlers/integration-data.d.ts +1 -1
  65. package/out/modules/integration/handlers/integration-login.d.ts +1 -1
  66. package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
  67. package/out/modules/integration/handlers/integration-update.d.ts +1 -1
  68. package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
  69. package/out/modules/integration/handlers/invite-users.d.ts +1 -1
  70. package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
  71. package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -1
  72. package/out/modules/integration/handlers/job-info.d.ts +1 -1
  73. package/out/modules/integration/handlers/job-list.d.ts +1 -1
  74. package/out/modules/integration/handlers/main.d.ts +1 -1
  75. package/out/modules/integration/handlers/main.js +13 -1
  76. package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
  77. package/out/modules/integration/handlers/oauth-login.js +10 -2
  78. package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
  79. package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
  80. package/out/modules/integration/handlers/settings-save.d.ts +1 -1
  81. package/out/modules/integration/handlers/settings.d.ts +1 -1
  82. package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
  83. package/out/modules/integration/handlers/sync-settings-save.js +0 -2
  84. package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
  85. package/out/modules/integration/handlers/user-errors.d.ts +1 -1
  86. package/out/modules/integration/handlers/users.d.ts +1 -1
  87. package/out/modules/integration/index.js +12 -33
  88. package/out/modules/integration/util/cron.js +1 -10
  89. package/out/modules/integration/util/job.js +0 -4
  90. package/out/modules/integration/util/snapshot.js +1 -5
  91. package/out/modules/integration/util/webhooks.js +1 -8
  92. package/out/modules/manifest.js +15 -13
  93. package/out/modules/modal/index.js +2 -2
  94. package/out/modules/organization-menu/index.js +5 -4
  95. package/out/modules/organization-settings-menu/index.js +5 -4
  96. package/out/modules/profile-resources-menu/index.js +5 -4
  97. package/out/modules/profile-settings-menu/index.js +5 -4
  98. package/out/modules/project-menu/index.js +1 -1
  99. package/out/modules/project-menu-crowdsource/index.js +1 -1
  100. package/out/modules/project-reports/index.js +3 -2
  101. package/out/modules/project-tools/index.js +3 -2
  102. package/out/modules/status.d.ts +1 -1
  103. package/out/modules/status.js +12 -3
  104. package/out/modules/subscription-paid.d.ts +1 -1
  105. package/out/modules/uninstall.d.ts +1 -1
  106. package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -1
  107. package/out/modules/webhooks/handlers/webhook-handler.js +30 -15
  108. package/out/modules/webhooks/types.d.ts +7 -0
  109. package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
  110. package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
  111. package/out/modules/workflow-step-type/index.js +2 -2
  112. package/out/storage/d1.d.ts +107 -0
  113. package/out/storage/d1.js +829 -0
  114. package/out/storage/index.js +8 -2
  115. package/out/storage/mysql.js +0 -3
  116. package/out/storage/postgre.js +0 -1
  117. package/out/storage/sqlite.js +0 -3
  118. package/out/types.d.ts +41 -2
  119. package/out/util/axios.js +0 -1
  120. package/out/util/credentials-masker.d.ts +1 -1
  121. package/out/util/cron.d.ts +29 -0
  122. package/out/util/cron.js +87 -0
  123. package/out/util/index.d.ts +12 -1
  124. package/out/util/index.js +54 -6
  125. package/out/util/jsx-renderer.d.ts +6 -0
  126. package/out/util/jsx-renderer.js +13 -0
  127. package/out/util/logger.js +0 -4
  128. package/out/util/static-files.d.ts +19 -0
  129. package/out/util/static-files.js +87 -0
  130. package/out/views/AboutPage.d.ts +10 -0
  131. package/out/views/AboutPage.js +76 -0
  132. package/out/views/ErrorPage.d.ts +18 -0
  133. package/out/views/ErrorPage.js +56 -0
  134. package/out/views/FormPage.d.ts +14 -0
  135. package/out/views/FormPage.js +28 -0
  136. package/out/views/InstallPage.d.ts +10 -0
  137. package/out/views/InstallPage.js +22 -0
  138. package/out/views/LoginPage.d.ts +33 -0
  139. package/out/views/LoginPage.js +200 -0
  140. package/out/views/MainPage.d.ts +81 -0
  141. package/out/views/MainPage.js +1784 -0
  142. package/out/views/OAuthPage.d.ts +7 -0
  143. package/out/views/OAuthPage.js +17 -0
  144. package/out/views/SubscriptionPage.d.ts +7 -0
  145. package/out/views/SubscriptionPage.js +26 -0
  146. package/out/views/index.d.ts +13 -0
  147. package/out/views/index.js +25 -0
  148. package/out/views/layout/Head.d.ts +9 -0
  149. package/out/views/layout/Head.js +54 -0
  150. package/package.json +33 -18
  151. package/out/util/handlebars.d.ts +0 -1
  152. package/out/util/handlebars.js +0 -46
  153. package/out/views/about.handlebars +0 -102
  154. package/out/views/error.handlebars +0 -54
  155. package/out/views/form.handlebars +0 -31
  156. package/out/views/install.handlebars +0 -16
  157. package/out/views/login.handlebars +0 -332
  158. package/out/views/main.handlebars +0 -2042
  159. package/out/views/oauth.handlebars +0 -11
  160. package/out/views/partials/head.handlebars +0 -53
  161. package/out/views/subscription.handlebars +0 -26
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
3
  import { CrowdinClientRequest } from '../../../types';
4
- export default function handle(): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
4
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Request, Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (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;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
3
  import { IntegrationLogic } from '../types';
4
- export default function handle(integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
4
+ export default function handle(integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config, CrowdinClientRequest } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Request, Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (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;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
- export default function handle(config: Config): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
4
+ export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -14,6 +14,7 @@ const logger_1 = require("../../../util/logger");
14
14
  const subscription_1 = require("../../../util/subscription");
15
15
  const defaults_1 = require("../util/defaults");
16
16
  const users_1 = require("./users");
17
+ const views_1 = require("../../../views");
17
18
  function handle(config, integration) {
18
19
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
19
20
  var _a, _b, _c, _d;
@@ -94,7 +95,18 @@ function handle(config, integration) {
94
95
  checkInterval: ((_d = integration.asyncProgress) === null || _d === void 0 ? void 0 : _d.checkInterval) || 1000,
95
96
  };
96
97
  logger(`Routing user to ${view} view`);
97
- return res.render(view, options);
98
+ let html;
99
+ if (view === 'install') {
100
+ html = (0, util_1.renderJSX)(views_1.InstallPage, options);
101
+ }
102
+ else if (view === 'login') {
103
+ html = (0, util_1.renderJSX)(views_1.LoginPage, options);
104
+ }
105
+ else {
106
+ html = (0, util_1.renderJSX)(views_1.MainPage, options);
107
+ }
108
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
109
+ return res.send(html);
98
110
  }));
99
111
  }
100
112
  exports.default = handle;
@@ -2,4 +2,4 @@
2
2
  import { Request, Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (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;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -18,6 +18,7 @@ const defaults_1 = require("../util/defaults");
18
18
  const logger_1 = require("../../../util/logger");
19
19
  const storage_1 = require("../../../storage");
20
20
  const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
21
+ const views_1 = require("../../../views");
21
22
  function handle(config, integration) {
22
23
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
23
24
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
@@ -66,12 +67,19 @@ function handle(config, integration) {
66
67
  const encryptedCredentials = (0, util_1.encryptData)(config, JSON.stringify(oauthCredentials));
67
68
  yield (0, storage_1.getStorage)().saveMetadata((0, defaults_1.getOAuthPollingId)(clientId), encryptedCredentials, organization);
68
69
  }
69
- return res.render('oauth', { message: JSON.stringify(message), oauthMode: (_p = integration.oauthLogin) === null || _p === void 0 ? void 0 : _p.mode });
70
+ const html = (0, util_1.renderJSX)(views_1.OAuthPage, {
71
+ message: JSON.stringify(message),
72
+ oauthMode: (_p = integration.oauthLogin) === null || _p === void 0 ? void 0 : _p.mode,
73
+ });
74
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
75
+ return res.send(html);
70
76
  }
71
77
  catch (e) {
72
78
  (0, logger_1.logError)(e);
73
79
  message.data = { error: (0, logger_1.getErrorMessage)(e) };
74
- return res.render('oauth', { message: JSON.stringify(message) });
80
+ const html = (0, util_1.renderJSX)(views_1.OAuthPage, { message: JSON.stringify(message) });
81
+ res.setHeader('Content-Type', 'text/html; charset=utf-8');
82
+ return res.send(html);
75
83
  }
76
84
  }));
77
85
  }
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config, CrowdinClientRequest } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config, CrowdinClientRequest } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,4 +2,4 @@
2
2
  import { Response } from 'express';
3
3
  import { Config } from '../../../types';
4
4
  import { IntegrationLogic } from '../types';
5
- export default function handle(config: Config, integration: IntegrationLogic): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -62,9 +62,7 @@ function handle(config, integration) {
62
62
  const allFiles = expandedFiles.map((node) => ({
63
63
  id: node.id,
64
64
  name: node.name,
65
- // eslint-disable-next-line @typescript-eslint/camelcase
66
65
  node_type: node.nodeType,
67
- // eslint-disable-next-line @typescript-eslint/camelcase
68
66
  parent_id: node.parentId,
69
67
  schedule: true,
70
68
  sync: false,
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Response } from 'express';
3
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -2,7 +2,7 @@
2
2
  import Crowdin, { UsersModel } from '@crowdin/crowdin-api-client';
3
3
  import { Response } from 'express';
4
4
  export type ProjectMember = UsersModel.ProjectMember | UsersModel.EnterpriseProjectMember;
5
- export default function handle(): (req: import("../../../types").CrowdinClientRequest | import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
5
+ export default function handle(): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | import("../../../types").CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
6
6
  export declare function isManager({ client, projectId, memberId, }: {
7
7
  client: Crowdin;
8
8
  projectId: number;
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -36,11 +13,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
13
  };
37
14
  Object.defineProperty(exports, "__esModule", { value: true });
38
15
  exports.register = void 0;
39
- const cron = __importStar(require("node-cron"));
40
16
  const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
41
17
  const integration_credentials_1 = __importDefault(require("../../middlewares/integration-credentials"));
42
18
  const json_response_1 = __importDefault(require("../../middlewares/json-response"));
43
19
  const util_1 = require("../../util");
20
+ const util_2 = require("../../util");
21
+ const cron_1 = require("../../util/cron");
44
22
  const defaults_1 = require("./util/defaults");
45
23
  const webhooks_1 = require("./util/webhooks");
46
24
  const crowdin_file_progress_1 = __importDefault(require("./handlers/crowdin-file-progress"));
@@ -68,7 +46,7 @@ const sync_settings_save_1 = __importDefault(require("./handlers/sync-settings-s
68
46
  const user_errors_1 = __importDefault(require("./handlers/user-errors"));
69
47
  const users_1 = __importDefault(require("./handlers/users"));
70
48
  const invite_users_1 = __importDefault(require("./handlers/invite-users"));
71
- const cron_1 = require("./util/cron");
49
+ const cron_2 = require("./util/cron");
72
50
  const storage_1 = require("../../storage");
73
51
  function register({ config, app }) {
74
52
  var _a, _b, _c;
@@ -77,7 +55,7 @@ function register({ config, app }) {
77
55
  return;
78
56
  }
79
57
  (0, defaults_1.applyIntegrationModuleDefaults)(config, integrationLogic);
80
- app.get((0, util_1.getLogoUrl)(integrationLogic, '/integration'), (req, res) => res.sendFile(integrationLogic.imagePath || config.imagePath));
58
+ app.use('/logo/integration', (0, util_2.serveLogo)(config, integrationLogic));
81
59
  app.get('/', (0, crowdin_client_1.default)({
82
60
  config,
83
61
  optional: true,
@@ -197,17 +175,18 @@ function register({ config, app }) {
197
175
  }), (0, oauth_polling_1.default)(config, integrationLogic));
198
176
  }
199
177
  }
178
+ const cron = (0, cron_1.getCron)();
200
179
  if (integrationLogic.cronJobs) {
201
180
  integrationLogic.cronJobs.forEach((job) => {
202
- cron.schedule(job.expression, () => (0, cron_1.runJob)({ config, integration: integrationLogic, job }).catch(console.error));
181
+ cron.schedule(job.expression, () => (0, cron_2.runJob)({ config, integration: integrationLogic, job }).catch(console.error));
203
182
  });
204
183
  }
205
184
  if (integrationLogic.withCronSync) {
206
- cron.schedule('0 * * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '1' }).catch(console.error));
207
- cron.schedule('0 */3 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '3' }).catch(console.error));
208
- cron.schedule('0 */6 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '6' }).catch(console.error));
209
- cron.schedule('0 */12 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '12' }).catch(console.error));
210
- cron.schedule('0 0 * * *', () => (0, cron_1.filesCron)({ config, integration: integrationLogic, period: '24' }).catch(console.error));
185
+ cron.schedule('0 * * * *', () => (0, cron_2.filesCron)({ config, integration: integrationLogic, period: '1' }).catch(console.error));
186
+ cron.schedule('0 */3 * * *', () => (0, cron_2.filesCron)({ config, integration: integrationLogic, period: '3' }).catch(console.error));
187
+ cron.schedule('0 */6 * * *', () => (0, cron_2.filesCron)({ config, integration: integrationLogic, period: '6' }).catch(console.error));
188
+ cron.schedule('0 */12 * * *', () => (0, cron_2.filesCron)({ config, integration: integrationLogic, period: '12' }).catch(console.error));
189
+ cron.schedule('0 0 * * *', () => (0, cron_2.filesCron)({ config, integration: integrationLogic, period: '24' }).catch(console.error));
211
190
  }
212
191
  // remove user errors
213
192
  cron.schedule('0 0 * * *', () => __awaiter(this, void 0, void 0, function* () {
@@ -216,6 +195,7 @@ function register({ config, app }) {
216
195
  yield (0, storage_1.getStorage)().deleteAllUsersErrorsOlderThan(`${date.getTime()}`);
217
196
  }
218
197
  }));
198
+ cron.schedule('0 0 1 * *', () => (0, cron_2.removeFinishedJobs)());
219
199
  if (integrationLogic.webhooks) {
220
200
  app.post(`${integrationLogic.webhooks.crowdinWebhookUrl
221
201
  ? integrationLogic.webhooks.crowdinWebhookUrl
@@ -252,6 +232,5 @@ function register({ config, app }) {
252
232
  checkSubscriptionExpiration: true,
253
233
  moduleKey: integrationLogic.key,
254
234
  }), (0, integration_credentials_1.default)(config, integrationLogic), (0, invite_users_1.default)());
255
- cron.schedule('0 0 1 * *', () => (0, cron_1.removeFinishedJobs)());
256
235
  }
257
236
  exports.register = register;
@@ -172,13 +172,9 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
172
172
  const context = {
173
173
  jwtPayload: {
174
174
  context: {
175
- // eslint-disable-next-line @typescript-eslint/camelcase
176
175
  project_id: projectId,
177
- // eslint-disable-next-line @typescript-eslint/camelcase
178
176
  organization_id: crowdinCredentials.organizationId,
179
- // eslint-disable-next-line @typescript-eslint/camelcase
180
177
  organization_domain: crowdinCredentials.domain,
181
- // eslint-disable-next-line @typescript-eslint/camelcase
182
178
  user_id: crowdinCredentials.userId,
183
179
  },
184
180
  },
@@ -221,7 +217,6 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
221
217
  (0, logger_1.logError)(e, context);
222
218
  return;
223
219
  }
224
- // eslint-disable-next-line @typescript-eslint/camelcase
225
220
  context.jwtPayload.context.project_identifier = projectData.identifier;
226
221
  const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, crowdinClient, projectId);
227
222
  const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
@@ -348,11 +343,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
348
343
  (0, logger_1.log)(`updateIntegration task for files cron job with period [${period}] for project ${projectId} completed`);
349
344
  }
350
345
  else {
351
- const allIntFiles = [...files, ...newFiles].map((file) => (Object.assign({ id: file.id, name: file.name, parentId: file.parent_id || file.parentId,
352
- // eslint-disable-next-line @typescript-eslint/camelcase
353
- parent_id: file.parent_id || file.parentId,
354
- // eslint-disable-next-line @typescript-eslint/camelcase
355
- node_type: file.nodeType || file.node_type }, (file.type ? { type: file.type } : {}))));
346
+ const allIntFiles = [...files, ...newFiles].map((file) => (Object.assign({ id: file.id, name: file.name, parentId: file.parent_id || file.parentId, parent_id: file.parent_id || file.parentId, node_type: file.nodeType || file.node_type }, (file.type ? { type: file.type } : {}))));
356
347
  let intFiles = allIntFiles.filter((file) => 'type' in file);
357
348
  if (integration.forcePushSources === true && currentFileSnapshot.length > 0) {
358
349
  const snapshotMap = new Map(currentFileSnapshot.map((f) => [f.id, f]));
@@ -260,13 +260,9 @@ function reRunInProgressJobs(config) {
260
260
  const context = {
261
261
  jwtPayload: {
262
262
  context: {
263
- // eslint-disable-next-line @typescript-eslint/camelcase
264
263
  project_id: projectId,
265
- // eslint-disable-next-line @typescript-eslint/camelcase
266
264
  organization_id: crowdinCredentials.organizationId,
267
- // eslint-disable-next-line @typescript-eslint/camelcase
268
265
  organization_domain: crowdinCredentials.domain,
269
- // eslint-disable-next-line @typescript-eslint/camelcase
270
266
  user_id: crowdinCredentials.userId,
271
267
  },
272
268
  },
@@ -65,11 +65,7 @@ function getIntegrationSnapshot(integration, integrationCredentials, integration
65
65
  files = (0, files_1.skipFilesByRegex)(files, integration.skipIntegrationNodes);
66
66
  }
67
67
  // trick for compatibility in requests and set files
68
- files = files.map((file) => (Object.assign(Object.assign({}, file), { parentId: file.parent_id || file.parentId,
69
- // eslint-disable-next-line @typescript-eslint/camelcase
70
- parent_id: file.parent_id || file.parentId,
71
- // eslint-disable-next-line @typescript-eslint/camelcase
72
- node_type: file.nodeType || file.node_type })));
68
+ files = files.map((file) => (Object.assign(Object.assign({}, file), { parentId: file.parent_id || file.parentId, parent_id: file.parent_id || file.parentId, node_type: file.nodeType || file.node_type })));
73
69
  return files;
74
70
  });
75
71
  }
@@ -266,11 +266,8 @@ function prepareWebhookData({ config, integration, provider, webhookUrlParam, })
266
266
  }
267
267
  const context = Object.assign({ jwtPayload: {
268
268
  context: {
269
- // eslint-disable-next-line @typescript-eslint/camelcase
270
269
  project_id: projectId,
271
- // eslint-disable-next-line @typescript-eslint/camelcase
272
270
  organization_id: crowdinCredentials === null || crowdinCredentials === void 0 ? void 0 : crowdinCredentials.organizationId,
273
- // eslint-disable-next-line @typescript-eslint/camelcase
274
271
  user_id: crowdinCredentials === null || crowdinCredentials === void 0 ? void 0 : crowdinCredentials.userId,
275
272
  },
276
273
  }, crowdinId: crowdinCredentials.id }, ((integrationCredentials === null || integrationCredentials === void 0 ? void 0 : integrationCredentials.id) && { clientId: integrationCredentials.id }));
@@ -325,11 +322,7 @@ function updateCrowdinFromWebhookRequest(args) {
325
322
  if (fileNodeType !== '1') {
326
323
  continue;
327
324
  }
328
- const initFile = Object.assign({ id: file.id, name: file.name, sync: false, schedule: true,
329
- // eslint-disable-next-line @typescript-eslint/camelcase
330
- parent_id: file.parent_id || file.parentId,
331
- // eslint-disable-next-line @typescript-eslint/camelcase
332
- node_type: file.nodeType || file.node_type || '1' }, (file.type ? { type: file.type } : {}));
325
+ const initFile = Object.assign({ id: file.id, name: file.name, sync: false, schedule: true, parent_id: file.parent_id || file.parentId, node_type: file.nodeType || file.node_type || '1' }, (file.type ? { type: file.type } : {}));
333
326
  if (syncSettings) {
334
327
  if (!syncFiles.find((obj) => obj.id === initFile.id)) {
335
328
  yield (0, storage_1.getStorage)().updateSyncSettings(JSON.stringify([...syncFiles, initFile]), syncSettings.integrationId, syncSettings.crowdinId, 'schedule', syncSettings.provider);
@@ -21,7 +21,7 @@ function handle(config) {
21
21
  // prevent possible overrides of the other modules
22
22
  config.projectIntegration = Object.assign(Object.assign({}, config.projectIntegration), { key: config.identifier + '-int' });
23
23
  modules['project-integrations'] = [
24
- Object.assign({ key: config.projectIntegration.key, name: config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config.projectIntegration, '/integration'), url: '/' }, (!!config.projectIntegration.environments && {
24
+ Object.assign({ key: config.projectIntegration.key, name: config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config, config.projectIntegration, '/integration'), url: '/' }, (!!config.projectIntegration.environments && {
25
25
  environments: normalizeEnvironments(config.projectIntegration.environments),
26
26
  })),
27
27
  ];
@@ -102,9 +102,11 @@ function handle(config) {
102
102
  // prevent possible overrides of the other modules
103
103
  config.customMT = Object.assign(Object.assign({}, config.customMT), { key: config.identifier + '-mt' });
104
104
  modules['custom-mt'] = [
105
- Object.assign(Object.assign(Object.assign({ key: config.customMT.key, name: config.name, logo: (0, util_1.getLogoUrl)(config.customMT, '/mt'), url: '/mt/translate', withContext: !!config.customMT.withContext }, (config.customMT.batchSize !== null && {
105
+ Object.assign(Object.assign(Object.assign(Object.assign({ key: config.customMT.key, name: config.name, logo: (0, util_1.getLogoUrl)(config, config.customMT, '/mt'), url: '/mt/translate', withContext: !!config.customMT.withContext }, ((0, util_1.isDefined)(config.customMT.splitStringsIntoChunks) && {
106
+ splitStringsIntoChunks: config.customMT.splitStringsIntoChunks,
107
+ })), ((0, util_1.isDefined)(config.customMT.batchSize) && {
106
108
  batchSize: config.customMT.batchSize,
107
- })), (config.customMT.maskEntities !== null && {
109
+ })), ((0, util_1.isDefined)(config.customMT.maskEntities) && {
108
110
  maskEntities: config.customMT.maskEntities,
109
111
  })), (!!config.customMT.environments && {
110
112
  environments: normalizeEnvironments(config.customMT.environments),
@@ -119,7 +121,7 @@ function handle(config) {
119
121
  key: config.organizationMenu.key,
120
122
  name: config.organizationMenu.name || config.name,
121
123
  url: '/organization-menu/' + (config.organizationMenu.fileName || 'index.html'),
122
- icon: (0, util_1.getLogoUrl)(config.organizationMenu, '/resources'),
124
+ icon: (0, util_1.getLogoUrl)(config, config.organizationMenu, '/resources'),
123
125
  },
124
126
  ];
125
127
  }
@@ -131,7 +133,7 @@ function handle(config) {
131
133
  key: config.organizationSettingsMenu.key,
132
134
  name: config.organizationSettingsMenu.name || config.name,
133
135
  url: '/organization-settings/' + (config.organizationSettingsMenu.fileName || 'index.html'),
134
- icon: (0, util_1.getLogoUrl)(config.organizationSettingsMenu, '/organization-settings'),
136
+ icon: (0, util_1.getLogoUrl)(config, config.organizationSettingsMenu, '/organization-settings'),
135
137
  },
136
138
  ];
137
139
  }
@@ -139,7 +141,7 @@ function handle(config) {
139
141
  // prevent possible overrides of the other modules
140
142
  config.profileResourcesMenu = Object.assign(Object.assign({}, config.profileResourcesMenu), { key: config.identifier + '-profile-resources-menu' });
141
143
  modules['profile-resources-menu'] = [
142
- Object.assign({ key: config.profileResourcesMenu.key, name: config.profileResourcesMenu.name || config.name, url: '/profile-resources/' + (config.profileResourcesMenu.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config.profileResourcesMenu, '/profile-resources') }, (!!config.profileResourcesMenu.environments && {
144
+ Object.assign({ key: config.profileResourcesMenu.key, name: config.profileResourcesMenu.name || config.name, url: '/profile-resources/' + (config.profileResourcesMenu.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config, config.profileResourcesMenu, '/profile-resources') }, (!!config.profileResourcesMenu.environments && {
143
145
  environments: normalizeEnvironments(config.profileResourcesMenu.environments),
144
146
  })),
145
147
  ];
@@ -148,7 +150,7 @@ function handle(config) {
148
150
  // prevent possible overrides of the other modules
149
151
  config.profileSettingsMenu = Object.assign(Object.assign({}, config.profileSettingsMenu), { key: config.identifier + '-profile-settings-menu' });
150
152
  modules['profile-settings-menu'] = [
151
- Object.assign({ key: config.profileSettingsMenu.key, name: config.profileSettingsMenu.name || config.name, url: '/profile-settings/' + (config.profileSettingsMenu.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config.profileSettingsMenu, '/profile-settings') }, (!!config.profileSettingsMenu.environments && {
153
+ Object.assign({ key: config.profileSettingsMenu.key, name: config.profileSettingsMenu.name || config.name, url: '/profile-settings/' + (config.profileSettingsMenu.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config, config.profileSettingsMenu, '/profile-settings') }, (!!config.profileSettingsMenu.environments && {
152
154
  environments: normalizeEnvironments(config.profileSettingsMenu.environments),
153
155
  })),
154
156
  ];
@@ -186,7 +188,7 @@ function handle(config) {
186
188
  // prevent possible overrides of the other modules
187
189
  config.projectTools = Object.assign(Object.assign({}, config.projectTools), { key: config.identifier + '-tools' });
188
190
  modules['project-tools'] = [
189
- Object.assign({ key: config.projectTools.key, name: config.projectTools.name || config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config.projectTools, '/tools'), url: '/tools/' + (config.projectTools.fileName || 'index.html') }, (!!config.projectTools.environments && {
191
+ Object.assign({ key: config.projectTools.key, name: config.projectTools.name || config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config, config.projectTools, '/tools'), url: '/tools/' + (config.projectTools.fileName || 'index.html') }, (!!config.projectTools.environments && {
190
192
  environments: normalizeEnvironments(config.projectTools.environments),
191
193
  })),
192
194
  ];
@@ -199,7 +201,7 @@ function handle(config) {
199
201
  key: config.projectReports.key,
200
202
  name: config.projectReports.name || config.name,
201
203
  description: config.description,
202
- logo: (0, util_1.getLogoUrl)(config.projectReports, '/reports'),
204
+ logo: (0, util_1.getLogoUrl)(config, config.projectReports, '/reports'),
203
205
  url: '/reports/' + (config.projectReports.fileName || 'index.html'),
204
206
  },
205
207
  ];
@@ -270,7 +272,7 @@ function handle(config) {
270
272
  config.aiProvider = Object.assign(Object.assign({}, config.aiProvider), { key: config.identifier + '-aiprovider' });
271
273
  const uiModule = config.aiProvider.settingsUiModule;
272
274
  modules['ai-provider'] = [
273
- Object.assign(Object.assign({ key: config.aiProvider.key, name: config.aiProvider.name || config.name, description: config.aiProvider.description || config.description, logo: (0, util_1.getLogoUrl)(config.aiProvider, '/aiprovider'), chatCompletionsUrl: '/ai-provider/completions', modelsUrl: '/ai-provider/models' }, (!!config.aiProvider.environments && {
275
+ Object.assign(Object.assign({ key: config.aiProvider.key, name: config.aiProvider.name || config.name, description: config.aiProvider.description || config.description, logo: (0, util_1.getLogoUrl)(config, config.aiProvider, '/aiprovider'), chatCompletionsUrl: '/ai-provider/completions', modelsUrl: '/ai-provider/models' }, (!!config.aiProvider.environments && {
274
276
  environments: normalizeEnvironments(config.aiProvider.environments),
275
277
  })), (uiModule ? { url: '/settings/' + (uiModule.fileName || 'index.html') } : {})),
276
278
  ];
@@ -295,7 +297,7 @@ function handle(config) {
295
297
  // prevent possible overrides of the other modules
296
298
  config.aiPromptProvider = Object.assign(Object.assign({}, config.aiPromptProvider), { key: config.identifier + '-ai-prompt-provider' });
297
299
  modules['ai-prompt-provider'] = [
298
- Object.assign(Object.assign({ key: config.aiPromptProvider.key, name: config.aiPromptProvider.name || config.name, logo: (0, util_1.getLogoUrl)(config.aiPromptProvider, '/ai-prompt-provider'), compileUrl: '/prompt-provider/compile' }, (config.aiPromptProvider.actions
300
+ Object.assign(Object.assign({ key: config.aiPromptProvider.key, name: config.aiPromptProvider.name || config.name, logo: (0, util_1.getLogoUrl)(config, config.aiPromptProvider, '/ai-prompt-provider'), compileUrl: '/prompt-provider/compile' }, (config.aiPromptProvider.actions
299
301
  ? {
300
302
  actions: config.aiPromptProvider.actions,
301
303
  }
@@ -384,7 +386,7 @@ function handle(config) {
384
386
  workflowStep.key = config.identifier + '-' + (0, util_3.getWorkflowStepKey)(workflowStep);
385
387
  }
386
388
  const uiModule = ((_b = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _b === void 0 ? void 0 : _b.formSchema) || ((_c = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _c === void 0 ? void 0 : _c.fileName);
387
- modules['workflow-step-type'].push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ key: workflowStep.key, name: workflowStep.name || config.name }, ((workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.imagePath) ? { logo: (0, util_1.getLogoUrl)(workflowStep, `-${workflowStep.key}`) } : {})), { description: workflowStep.description || config.description, boundaries: workflowStep.boundaries }), (workflowStep.editorMode ? { editorMode: workflowStep.editorMode } : {})), { updateSettingsUrl: (0, util_3.getWorkflowStepUrl)('/workflow-step/settings', workflowStep), deleteSettingsUrl: (0, util_3.getWorkflowStepUrl)('/workflow-step/delete', workflowStep) }), (uiModule ? { url: (0, util_3.getWorkflowStepUrl)('/workflow-step', workflowStep) } : {})));
389
+ modules['workflow-step-type'].push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ key: workflowStep.key, name: workflowStep.name || config.name }, ((workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.imagePath) ? { logo: (0, util_1.getLogoUrl)(config, workflowStep, `-${workflowStep.key}`) } : {})), { description: workflowStep.description || config.description, boundaries: workflowStep.boundaries }), (workflowStep.editorMode ? { editorMode: workflowStep.editorMode } : {})), { updateSettingsUrl: (0, util_3.getWorkflowStepUrl)('/workflow-step/settings', workflowStep), deleteSettingsUrl: (0, util_3.getWorkflowStepUrl)('/workflow-step/delete', workflowStep) }), (uiModule ? { url: (0, util_3.getWorkflowStepUrl)('/workflow-step', workflowStep) } : {})));
388
390
  }
389
391
  }
390
392
  if (config.automationAction) {
@@ -448,7 +450,7 @@ function handle(config) {
448
450
  events['subscription_paid'] = '/subscription-paid';
449
451
  }
450
452
  return (_req, res) => {
451
- const manifest = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: config.identifier, name: config.name, logo: (0, util_1.getLogoUrl)(), baseUrl: config.baseUrl, authentication: {
453
+ const manifest = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: config.identifier, name: config.name, logo: (0, util_1.getLogoUrl)(config), baseUrl: config.baseUrl, authentication: {
452
454
  type: config.authenticationType || types_1.AuthenticationType.APP,
453
455
  clientId: config.clientId,
454
456
  }, restrictAiToSameApp: config.restrictAiToSameApp }, (config.stringBasedAvailable !== undefined && { stringBasedAvailable: config.stringBasedAvailable })), (config.agent && { agent: config.agent })), { events, scopes: config.scopes ? config.scopes : [types_1.Scope.PROJECTS] }), (config.defaultPermissions && { default_permissions: config.defaultPermissions })), { modules });
@@ -16,14 +16,14 @@ function register({ config, app }) {
16
16
  if (Array.isArray(config.modal)) {
17
17
  config.modal.forEach((modal) => {
18
18
  if ((modal === null || modal === void 0 ? void 0 : modal.uiPath) || (modal === null || modal === void 0 ? void 0 : modal.formSchema)) {
19
- app.use(`/modal-${modal.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: modal.key }), (0, render_ui_module_1.default)(modal));
19
+ app.use(`/modal-${modal.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: modal.key }), (0, render_ui_module_1.default)(modal, config));
20
20
  }
21
21
  });
22
22
  }
23
23
  else {
24
24
  // backward compatibility will be removed after migration
25
25
  if (((_a = config.modal) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.modal) === null || _b === void 0 ? void 0 : _b.formSchema)) {
26
- app.use('/modal', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.modal.key }), (0, render_ui_module_1.default)(config.modal));
26
+ app.use('/modal', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.modal.key }), (0, render_ui_module_1.default)(config.modal, config));
27
27
  }
28
28
  }
29
29
  }