@crowdin/app-project-module 1.7.2 → 1.8.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.
package/out/index.js CHANGED
@@ -304,8 +304,17 @@ function addCrowdinEndpoints(app, clientConfig) {
304
304
  } });
305
305
  }
306
306
  function addFormSchema({ app, config }) {
307
+ const allModuleConfigs = [];
307
308
  for (const moduleKey of Object.keys(config)) {
308
- const moduleConfig = config[moduleKey];
309
+ const value = config[moduleKey];
310
+ if (Array.isArray(value)) {
311
+ allModuleConfigs.push(...value);
312
+ }
313
+ else {
314
+ allModuleConfigs.push(value);
315
+ }
316
+ }
317
+ for (const moduleConfig of allModuleConfigs) {
309
318
  if ((0, form_schema_1.hasFormSchema)(moduleConfig)) {
310
319
  const moduleConfigWithForm = (0, form_schema_1.getLowCodeUiConfigFromModuleConfig)(moduleConfig);
311
320
  if (moduleConfigWithForm) {
@@ -10,18 +10,33 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
10
10
  const util_1 = require("../../util");
11
11
  const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
12
12
  const compile_1 = __importDefault(require("./handlers/compile"));
13
+ const normalize_module_1 = require("../../util/normalize-module");
13
14
  function register({ config, app }) {
15
+ var _a;
14
16
  if (!config.aiPromptProvider) {
15
17
  return;
16
18
  }
17
- app.post('/prompt-provider/compile', json_response_1.default, (0, crowdin_client_1.default)({
18
- config,
19
- optional: false,
20
- checkSubscriptionExpiration: true,
21
- moduleKey: config.aiPromptProvider.key,
22
- }), (0, compile_1.default)(config.aiPromptProvider));
23
- if (config.aiPromptProvider.formSchema || config.aiPromptProvider.uiPath) {
24
- app.use('/prompt-provider/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiPromptProvider.key }), (0, render_ui_module_1.default)(config.aiPromptProvider, config));
19
+ const items = (0, normalize_module_1.normalizeToArray)(config.aiPromptProvider);
20
+ const isSingle = items.length === 1;
21
+ for (const [index, provider] of items.entries()) {
22
+ const key = (_a = provider.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
23
+ identifier: config.identifier,
24
+ suffix: 'ai-prompt-provider',
25
+ item: provider,
26
+ index,
27
+ isSingle,
28
+ });
29
+ const base = isSingle ? '/prompt-provider' : `/prompt-provider/${key}`;
30
+ const logoPath = isSingle ? '/logo/ai-prompt-provider' : `/logo/ai-prompt-provider-${key}`;
31
+ app.post(`${base}/compile`, json_response_1.default, (0, crowdin_client_1.default)({
32
+ config,
33
+ optional: false,
34
+ checkSubscriptionExpiration: true,
35
+ moduleKey: key,
36
+ }), (0, compile_1.default)(provider));
37
+ if (provider.formSchema || provider.uiPath) {
38
+ app.use(`${base}/settings`, (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: key }), (0, render_ui_module_1.default)(provider, config));
39
+ }
40
+ app.use(logoPath, (0, util_1.serveLogo)(config, provider));
25
41
  }
26
- app.use('/logo/ai-prompt-provider', (0, util_1.serveLogo)(config, config.aiPromptProvider));
27
42
  }
@@ -11,36 +11,55 @@ const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
11
11
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
12
12
  const util_1 = require("../../util");
13
13
  const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
14
+ const normalize_module_1 = require("../../util/normalize-module");
14
15
  function register({ config, app }) {
16
+ var _a;
15
17
  if (!config.aiProvider) {
16
18
  return;
17
19
  }
18
- if (config.aiProvider.settingsUiModule) {
19
- app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.aiProvider.key }), (0, render_ui_module_1.default)(config.aiProvider.settingsUiModule, config));
20
+ const items = (0, normalize_module_1.normalizeToArray)(config.aiProvider);
21
+ const isSingle = items.length === 1;
22
+ for (const [index, provider] of items.entries()) {
23
+ const key = (_a = provider.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
24
+ identifier: config.identifier,
25
+ suffix: 'aiprovider',
26
+ item: provider,
27
+ index,
28
+ isSingle,
29
+ });
30
+ const base = isSingle ? '/ai-provider' : `/ai-provider/${key}`;
31
+ const logoPath = isSingle ? '/logo/aiprovider' : `/logo/aiprovider-${key}`;
32
+ const settingsBase = isSingle ? '' : `/${key}`;
33
+ if (provider.settingsUiModule) {
34
+ app.use(`/settings${settingsBase}`, (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: key }), (0, render_ui_module_1.default)(provider.settingsUiModule, config));
35
+ }
36
+ app.use(logoPath, (0, util_1.serveLogo)(config, provider));
37
+ app.get(`${base}/models`, json_response_1.default, (0, crowdin_client_1.default)({
38
+ config,
39
+ optional: false,
40
+ checkSubscriptionExpiration: true,
41
+ moduleKey: key,
42
+ }), (0, get_model_list_1.default)(provider));
43
+ app.post(`${base}/completions`, json_response_1.default, (0, crowdin_client_1.default)({
44
+ config,
45
+ optional: false,
46
+ checkSubscriptionExpiration: true,
47
+ moduleKey: key,
48
+ }), (0, chat_completions_1.default)(provider));
49
+ }
50
+ if (isSingle) {
51
+ const provider = items[0];
52
+ // TEMPORARY CODE: it needs to support old path
53
+ app.get('/models', json_response_1.default, (0, crowdin_client_1.default)({
54
+ config,
55
+ optional: false,
56
+ checkSubscriptionExpiration: true,
57
+ }), (0, get_model_list_1.default)(provider));
58
+ app.post('/completions', json_response_1.default, (0, crowdin_client_1.default)({
59
+ config,
60
+ optional: false,
61
+ checkSubscriptionExpiration: true,
62
+ }), (0, chat_completions_1.default)(provider));
63
+ // END TEMPORARY CODE
20
64
  }
21
- app.use('/logo/aiprovider', (0, util_1.serveLogo)(config, config.aiProvider));
22
- app.get('/ai-provider/models', json_response_1.default, (0, crowdin_client_1.default)({
23
- config,
24
- optional: false,
25
- checkSubscriptionExpiration: true,
26
- moduleKey: config.aiProvider.key,
27
- }), (0, get_model_list_1.default)(config.aiProvider));
28
- app.post('/ai-provider/completions', json_response_1.default, (0, crowdin_client_1.default)({
29
- config,
30
- optional: false,
31
- checkSubscriptionExpiration: true,
32
- moduleKey: config.aiProvider.key,
33
- }), (0, chat_completions_1.default)(config.aiProvider));
34
- // TEMPORARY CODE: it needs to support old path
35
- app.get('/models', json_response_1.default, (0, crowdin_client_1.default)({
36
- config,
37
- optional: false,
38
- checkSubscriptionExpiration: true,
39
- }), (0, get_model_list_1.default)(config.aiProvider));
40
- app.post('/completions', json_response_1.default, (0, crowdin_client_1.default)({
41
- config,
42
- optional: false,
43
- checkSubscriptionExpiration: true,
44
- }), (0, chat_completions_1.default)(config.aiProvider));
45
- // END TEMPORARY CODE
46
65
  }
@@ -8,6 +8,7 @@ exports.generateModuleSlugFromType = generateModuleSlugFromType;
8
8
  exports.register = register;
9
9
  const json_response_1 = __importDefault(require("../../middlewares/json-response"));
10
10
  const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  const handler_1 = __importDefault(require("./handler"));
12
13
  var AiRequestProcessorModuleWithStream;
13
14
  (function (AiRequestProcessorModuleWithStream) {
@@ -26,16 +27,25 @@ function generateModuleSlugFromType(moduleType) {
26
27
  .toLowerCase();
27
28
  }
28
29
  function registerProcessorModuleByTypeKey(moduleKey, { config, app }) {
29
- const module = config[moduleKey];
30
- if (!module) {
30
+ var _a;
31
+ const moduleValue = config[moduleKey];
32
+ if (!moduleValue) {
31
33
  return;
32
34
  }
33
- app.post('/ai-request-processor/' + generateModuleSlugFromType(moduleKey), json_response_1.default, (0, crowdin_client_1.default)({
34
- config,
35
- optional: false,
36
- checkSubscriptionExpiration: true,
37
- moduleKey: module.key,
38
- }), (0, handler_1.default)(module, moduleKey in AiRequestProcessorModuleWithStream));
35
+ const moduleSlug = generateModuleSlugFromType(moduleKey);
36
+ const items = (0, normalize_module_1.normalizeToArray)(moduleValue);
37
+ const isSingle = items.length === 1;
38
+ const isStream = moduleKey in AiRequestProcessorModuleWithStream;
39
+ for (const [index, module] of items.entries()) {
40
+ const key = (_a = module.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: moduleSlug, item: module, index, isSingle });
41
+ const url = isSingle ? '/ai-request-processor/' + moduleSlug : `/ai-request-processor/${moduleSlug}/${key}`;
42
+ app.post(url, json_response_1.default, (0, crowdin_client_1.default)({
43
+ config,
44
+ optional: false,
45
+ checkSubscriptionExpiration: true,
46
+ moduleKey: key,
47
+ }), (0, handler_1.default)(module, isStream));
48
+ }
39
49
  }
40
50
  function register({ config, app }) {
41
51
  [
@@ -6,26 +6,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.register = register;
7
7
  const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
8
8
  const util_1 = require("../../util");
9
+ const normalize_module_1 = require("../../util/normalize-module");
9
10
  const file_download_1 = __importDefault(require("../file-processing/handlers/file-download"));
10
11
  const translate_1 = __importDefault(require("./handlers/translate"));
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.customMT) {
13
15
  return;
14
16
  }
15
- const folder = config.customMT.filesFolder || config.dbFolder;
16
- app.use('/logo/mt', (0, util_1.serveLogo)(config, config.customMT));
17
- app.post('/mt/translate', (0, crowdin_client_1.default)({
18
- config,
19
- optional: false,
20
- checkSubscriptionExpiration: true,
21
- moduleKey: config.customMT.key,
22
- }), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: config.customMT, fileStore: config.fileStore }));
23
- app.get('/file/download/custom-mt', (0, file_download_1.default)(config, config.customMT, 'custom-mt'));
24
- // TEMPORARY CODE: it needs to support old path
25
- app.post('/translate', (0, crowdin_client_1.default)({
26
- config,
27
- optional: false,
28
- checkSubscriptionExpiration: true,
29
- }), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: config.customMT, fileStore: config.fileStore }));
30
- // END TEMPORARY CODE
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.customMT);
18
+ const isSingle = items.length === 1;
19
+ for (const [index, mt] of items.entries()) {
20
+ const key = (_a = mt.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'mt', item: mt, index, isSingle });
21
+ const folder = mt.filesFolder || config.dbFolder;
22
+ const logoPath = isSingle ? '/logo/mt' : `/logo/mt-${key}`;
23
+ const translatePath = isSingle ? '/mt/translate' : `/mt/${key}/translate`;
24
+ const downloadPath = isSingle ? '/file/download/custom-mt' : `/file/download/custom-mt-${key}`;
25
+ app.use(logoPath, (0, util_1.serveLogo)(config, mt));
26
+ app.post(translatePath, (0, crowdin_client_1.default)({
27
+ config,
28
+ optional: false,
29
+ checkSubscriptionExpiration: true,
30
+ moduleKey: key,
31
+ }), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: mt, fileStore: config.fileStore }));
32
+ app.get(downloadPath, (0, file_download_1.default)(config, mt, 'custom-mt'));
33
+ }
34
+ if (isSingle) {
35
+ const mt = items[0];
36
+ const folder = mt.filesFolder || config.dbFolder;
37
+ // TEMPORARY CODE: it needs to support old path
38
+ app.post('/translate', (0, crowdin_client_1.default)({
39
+ config,
40
+ optional: false,
41
+ checkSubscriptionExpiration: true,
42
+ }), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: mt, fileStore: config.fileStore }));
43
+ // END TEMPORARY CODE
44
+ }
31
45
  }
@@ -9,55 +9,85 @@ const json_response_1 = __importDefault(require("../../middlewares/json-response
9
9
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
10
10
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
11
11
  const util_1 = require("../../util");
12
+ const normalize_module_1 = require("../../util/normalize-module");
12
13
  const get_languages_list_1 = __importDefault(require("./handlers/get-languages-list"));
13
14
  const spell_check_1 = __importDefault(require("./handlers/spell-check"));
14
15
  function register({ config, app }) {
16
+ var _a, _b;
15
17
  if (!config.customSpellchecker) {
16
18
  return;
17
19
  }
20
+ const items = (0, normalize_module_1.normalizeToArray)(config.customSpellchecker);
21
+ const isSingle = items.length === 1;
18
22
  if ((0, util_1.isAuthorizedConfig)(config)) {
19
- if (config.customSpellchecker.settingsUiModule) {
20
- app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
23
+ for (const [index, spellchecker] of items.entries()) {
24
+ const key = (_a = spellchecker.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
25
+ identifier: config.identifier,
26
+ suffix: 'spellchecker',
27
+ item: spellchecker,
28
+ index,
29
+ isSingle,
30
+ });
31
+ const base = isSingle ? '/spellchecker' : `/spellchecker/${key}`;
32
+ if (spellchecker.settingsUiModule) {
33
+ app.use(`${base}/settings`, (0, ui_module_1.default)({ config, moduleType: key }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
34
+ }
35
+ app.get(`${base}/languages`, json_response_1.default, (0, crowdin_client_1.default)({
36
+ config,
37
+ optional: false,
38
+ checkSubscriptionExpiration: true,
39
+ moduleKey: key,
40
+ }), (0, get_languages_list_1.default)(spellchecker));
41
+ app.post(`${base}/spellcheck`, json_response_1.default, (0, crowdin_client_1.default)({
42
+ config,
43
+ optional: false,
44
+ checkSubscriptionExpiration: true,
45
+ moduleKey: key,
46
+ }), (0, spell_check_1.default)(spellchecker));
47
+ }
48
+ if (isSingle) {
49
+ const spellchecker = items[0];
21
50
  // TEMPORARY CODE: it needs to support old path
22
- app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
51
+ if (spellchecker.settingsUiModule) {
52
+ app.use('/settings', (0, ui_module_1.default)({ config }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
53
+ }
54
+ app.get('/languages', json_response_1.default, (0, crowdin_client_1.default)({
55
+ config,
56
+ optional: false,
57
+ checkSubscriptionExpiration: true,
58
+ }), (0, get_languages_list_1.default)(spellchecker));
59
+ app.post('/spellcheck', json_response_1.default, (0, crowdin_client_1.default)({
60
+ config,
61
+ optional: false,
62
+ checkSubscriptionExpiration: true,
63
+ }), (0, spell_check_1.default)(spellchecker));
23
64
  // END TEMPORARY CODE
24
65
  }
25
- app.get('/spellchecker/languages', json_response_1.default, (0, crowdin_client_1.default)({
26
- config,
27
- optional: false,
28
- checkSubscriptionExpiration: true,
29
- moduleKey: config.customSpellchecker.key,
30
- }), (0, get_languages_list_1.default)(config.customSpellchecker));
31
- app.post('/spellchecker/spellcheck', json_response_1.default, (0, crowdin_client_1.default)({
32
- config,
33
- optional: false,
34
- checkSubscriptionExpiration: true,
35
- moduleKey: config.customSpellchecker.key,
36
- }), (0, spell_check_1.default)(config.customSpellchecker));
37
- // TEMPORARY CODE: it needs to support old path
38
- app.get('/languages', json_response_1.default, (0, crowdin_client_1.default)({
39
- config,
40
- optional: false,
41
- checkSubscriptionExpiration: true,
42
- }), (0, get_languages_list_1.default)(config.customSpellchecker));
43
- app.post('/spellcheck', json_response_1.default, (0, crowdin_client_1.default)({
44
- config,
45
- optional: false,
46
- checkSubscriptionExpiration: true,
47
- }), (0, spell_check_1.default)(config.customSpellchecker));
48
- // END TEMPORARY CODE
49
66
  return;
50
67
  }
51
- if (config.customSpellchecker.settingsUiModule) {
52
- app.use('/spellchecker/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: config.customSpellchecker.key }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
68
+ for (const [index, spellchecker] of items.entries()) {
69
+ const key = (_b = spellchecker.key) !== null && _b !== void 0 ? _b : (0, normalize_module_1.resolveInstanceKey)({
70
+ identifier: config.identifier,
71
+ suffix: 'spellchecker',
72
+ item: spellchecker,
73
+ index,
74
+ isSingle,
75
+ });
76
+ const base = isSingle ? '/spellchecker' : `/spellchecker/${key}`;
77
+ if (spellchecker.settingsUiModule) {
78
+ app.use(`${base}/settings`, (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: key }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
79
+ }
80
+ app.get(`${base}/languages`, json_response_1.default, (0, get_languages_list_1.default)(spellchecker));
81
+ app.post(`${base}/spellcheck`, json_response_1.default, (0, spell_check_1.default)(spellchecker));
82
+ }
83
+ if (isSingle) {
84
+ const spellchecker = items[0];
53
85
  // TEMPORARY CODE: it needs to support old path
54
- app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(config.customSpellchecker.settingsUiModule, config));
86
+ if (spellchecker.settingsUiModule) {
87
+ app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(spellchecker.settingsUiModule, config));
88
+ }
89
+ app.get('/languages', json_response_1.default, (0, get_languages_list_1.default)(spellchecker));
90
+ app.post('/spellcheck', json_response_1.default, (0, spell_check_1.default)(spellchecker));
55
91
  // END TEMPORARY CODE
56
92
  }
57
- app.get('/spellchecker/languages', json_response_1.default, (0, get_languages_list_1.default)(config.customSpellchecker));
58
- app.post('/spellchecker/spellcheck', json_response_1.default, (0, spell_check_1.default)(config.customSpellchecker));
59
- // TEMPORARY CODE: it needs to support old path
60
- app.get('/languages', json_response_1.default, (0, get_languages_list_1.default)(config.customSpellchecker));
61
- app.post('/spellcheck', json_response_1.default, (0, spell_check_1.default)(config.customSpellchecker));
62
- // END TEMPORARY CODE
63
93
  }
@@ -7,10 +7,18 @@ exports.register = register;
7
7
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
+ const normalize_module_1 = require("../../util/normalize-module");
10
11
  function register({ config, app }) {
12
+ var _a;
11
13
  if (!config.editorRightPanel) {
12
14
  return;
13
15
  }
16
+ const items = (0, normalize_module_1.normalizeToArray)(config.editorRightPanel);
17
+ const isSingle = items.length === 1;
14
18
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
- app.use('/editor-panels', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.editorRightPanel.key }), (0, render_ui_module_1.default)(config.editorRightPanel, config));
19
+ for (const [index, item] of items.entries()) {
20
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'editor-panels', item, index, isSingle });
21
+ const basePath = isSingle ? '/editor-panels' : `/editor-panels-${key}`;
22
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
23
+ }
16
24
  }
@@ -8,39 +8,55 @@ const json_response_1 = __importDefault(require("../../middlewares/json-response
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
10
10
  const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  const validate_1 = __importDefault(require("./handlers/validate"));
12
13
  function register({ config, app }) {
13
- const qaCheck = config.externalQaCheck;
14
- if (!qaCheck) {
14
+ var _a;
15
+ if (!config.externalQaCheck) {
15
16
  return;
16
17
  }
17
- if (qaCheck === null || qaCheck === void 0 ? void 0 : qaCheck.batchSize) {
18
- app.use('/qa-check/batch-size', json_response_1.default, (req, res) => {
19
- res.send({ data: { size: qaCheck.batchSize } });
18
+ const items = (0, normalize_module_1.normalizeToArray)(config.externalQaCheck);
19
+ const isSingle = items.length === 1;
20
+ for (const [index, qaCheck] of items.entries()) {
21
+ const key = (_a = qaCheck.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
22
+ identifier: config.identifier,
23
+ suffix: 'qa-check',
24
+ item: qaCheck,
25
+ index,
26
+ isSingle,
20
27
  });
21
- // TEMPORARY CODE: it needs to support old path
22
- app.use('/batch-size', json_response_1.default, (req, res) => {
23
- res.send({ data: { size: qaCheck.batchSize } });
24
- });
25
- // END TEMPORARY CODE
28
+ const base = isSingle ? '/qa-check' : `/qa-check/${key}`;
29
+ if (qaCheck === null || qaCheck === void 0 ? void 0 : qaCheck.batchSize) {
30
+ app.use(`${base}/batch-size`, json_response_1.default, (req, res) => {
31
+ res.send({ data: { size: qaCheck.batchSize } });
32
+ });
33
+ }
34
+ app.use(`${base}/validate`, json_response_1.default, (0, crowdin_client_1.default)({
35
+ config,
36
+ optional: false,
37
+ checkSubscriptionExpiration: true,
38
+ moduleKey: key,
39
+ }), (0, validate_1.default)(qaCheck));
40
+ if (qaCheck.settingsUiModule) {
41
+ app.use(`${base}/settings`, (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: key }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule, config));
42
+ }
26
43
  }
27
- app.use('/qa-check/validate', json_response_1.default, (0, crowdin_client_1.default)({
28
- config,
29
- optional: false,
30
- checkSubscriptionExpiration: true,
31
- moduleKey: qaCheck.key,
32
- }), (0, validate_1.default)(qaCheck));
33
- // TEMPORARY CODE: it needs to support old path
34
- app.use('/validate', json_response_1.default, (0, crowdin_client_1.default)({
35
- config,
36
- optional: false,
37
- checkSubscriptionExpiration: true,
38
- }), (0, validate_1.default)(qaCheck));
39
- // END TEMPORARY CODE
40
- if (qaCheck.settingsUiModule) {
41
- app.use('/qa-check/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true, moduleType: qaCheck.key }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule, config));
44
+ if (isSingle) {
45
+ const qaCheck = items[0];
42
46
  // TEMPORARY CODE: it needs to support old path
43
- app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule, config));
47
+ if (qaCheck === null || qaCheck === void 0 ? void 0 : qaCheck.batchSize) {
48
+ app.use('/batch-size', json_response_1.default, (req, res) => {
49
+ res.send({ data: { size: qaCheck.batchSize } });
50
+ });
51
+ }
52
+ app.use('/validate', json_response_1.default, (0, crowdin_client_1.default)({
53
+ config,
54
+ optional: false,
55
+ checkSubscriptionExpiration: true,
56
+ }), (0, validate_1.default)(qaCheck));
57
+ if (qaCheck.settingsUiModule) {
58
+ app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized: true }), (0, render_ui_module_1.default)(qaCheck.settingsUiModule, config));
59
+ }
44
60
  // END TEMPORARY CODE
45
61
  }
46
62
  }