@crowdin/app-project-module 1.7.1 → 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.
@@ -8,15 +8,27 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  const util_2 = require("../../util");
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.organizationMenu) {
13
15
  return;
14
16
  }
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.organizationMenu);
18
+ const isSingle = items.length === 1;
15
19
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
16
- app.use('/logo/organization-menu', (0, util_2.serveLogo)(config, config.organizationMenu));
17
- app.use('/organization-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationMenu.key }), (0, render_ui_module_1.default)(config.organizationMenu, config));
18
- // TEMPORARY CODE: it needs to support old path
19
- app.use('/logo/resources', (0, util_2.serveLogo)(config, config.organizationMenu));
20
- app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationMenu, config));
21
- // END TEMPORARY CODE
20
+ for (const [index, item] of items.entries()) {
21
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'resources', item, index, isSingle });
22
+ const basePath = isSingle ? '/organization-menu' : `/organization-menu-${key}`;
23
+ const logoPath = isSingle ? '/logo/organization-menu' : `/logo/organization-menu-${key}`;
24
+ app.use(logoPath, (0, util_2.serveLogo)(config, item));
25
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
26
+ }
27
+ if (isSingle) {
28
+ const item = items[0];
29
+ // TEMPORARY CODE: it needs to support old path
30
+ app.use('/logo/resources', (0, util_2.serveLogo)(config, item));
31
+ app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(item, config));
32
+ // END TEMPORARY CODE
33
+ }
22
34
  }
@@ -8,15 +8,33 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  const util_2 = require("../../util");
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.organizationSettingsMenu) {
13
15
  return;
14
16
  }
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.organizationSettingsMenu);
18
+ const isSingle = items.length === 1;
15
19
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
16
- app.use('/logo/organization-settings', (0, util_2.serveLogo)(config, config.organizationSettingsMenu));
17
- app.use('/organization-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.organizationSettingsMenu.key }), (0, render_ui_module_1.default)(config.organizationSettingsMenu, config));
18
- // TEMPORARY CODE: it needs to support old path
19
- app.use('/logo/settings', (0, util_2.serveLogo)(config, config.organizationSettingsMenu));
20
- app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.organizationSettingsMenu, config));
21
- // END TEMPORARY CODE
20
+ for (const [index, item] of items.entries()) {
21
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
22
+ identifier: config.identifier,
23
+ suffix: 'organization-settings-menu',
24
+ item,
25
+ index,
26
+ isSingle,
27
+ });
28
+ const basePath = isSingle ? '/organization-settings' : `/organization-settings-${key}`;
29
+ const logoPath = isSingle ? '/logo/organization-settings' : `/logo/organization-settings-${key}`;
30
+ app.use(logoPath, (0, util_2.serveLogo)(config, item));
31
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
32
+ }
33
+ if (isSingle) {
34
+ const item = items[0];
35
+ // TEMPORARY CODE: it needs to support old path
36
+ app.use('/logo/settings', (0, util_2.serveLogo)(config, item));
37
+ app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(item, config));
38
+ // END TEMPORARY CODE
39
+ }
22
40
  }
@@ -8,15 +8,33 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  const util_2 = require("../../util");
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.profileResourcesMenu) {
13
15
  return;
14
16
  }
15
- app.use('/logo/profile-resources', (0, util_2.serveLogo)(config, config.profileResourcesMenu));
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.profileResourcesMenu);
18
+ const isSingle = items.length === 1;
16
19
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
17
- app.use('/profile-resources', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileResourcesMenu.key }), (0, render_ui_module_1.default)(config.profileResourcesMenu, config));
18
- // TEMPORARY CODE: it needs to support old path
19
- app.use('/logo/resources', (0, util_2.serveLogo)(config, config.profileResourcesMenu));
20
- app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileResourcesMenu, config));
21
- // END TEMPORARY CODE
20
+ for (const [index, item] of items.entries()) {
21
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
22
+ identifier: config.identifier,
23
+ suffix: 'profile-resources-menu',
24
+ item,
25
+ index,
26
+ isSingle,
27
+ });
28
+ const basePath = isSingle ? '/profile-resources' : `/profile-resources-${key}`;
29
+ const logoPath = isSingle ? '/logo/profile-resources' : `/logo/profile-resources-${key}`;
30
+ app.use(logoPath, (0, util_2.serveLogo)(config, item));
31
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
32
+ }
33
+ if (isSingle) {
34
+ const item = items[0];
35
+ // TEMPORARY CODE: it needs to support old path
36
+ app.use('/logo/resources', (0, util_2.serveLogo)(config, item));
37
+ app.use('/resources', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(item, config));
38
+ // END TEMPORARY CODE
39
+ }
22
40
  }
@@ -8,15 +8,33 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  const util_2 = require("../../util");
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.profileSettingsMenu) {
13
15
  return;
14
16
  }
15
- app.use('/logo/profile-settings', (0, util_2.serveLogo)(config, config.profileSettingsMenu));
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.profileSettingsMenu);
18
+ const isSingle = items.length === 1;
16
19
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
17
- app.use('/profile-settings', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.profileSettingsMenu.key }), (0, render_ui_module_1.default)(config.profileSettingsMenu, config));
18
- // TEMPORARY CODE: it needs to support old path
19
- app.use('/logo/settings', (0, util_2.serveLogo)(config, config.profileSettingsMenu));
20
- app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(config.profileSettingsMenu, config));
21
- // END TEMPORARY CODE
20
+ for (const [index, item] of items.entries()) {
21
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({
22
+ identifier: config.identifier,
23
+ suffix: 'profile-settings-menu',
24
+ item,
25
+ index,
26
+ isSingle,
27
+ });
28
+ const basePath = isSingle ? '/profile-settings' : `/profile-settings-${key}`;
29
+ const logoPath = isSingle ? '/logo/profile-settings' : `/logo/profile-settings-${key}`;
30
+ app.use(logoPath, (0, util_2.serveLogo)(config, item));
31
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
32
+ }
33
+ if (isSingle) {
34
+ const item = items[0];
35
+ // TEMPORARY CODE: it needs to support old path
36
+ app.use('/logo/settings', (0, util_2.serveLogo)(config, item));
37
+ app.use('/settings', (0, ui_module_1.default)({ config, allowUnauthorized }), (0, render_ui_module_1.default)(item, config));
38
+ // END TEMPORARY CODE
39
+ }
22
40
  }
@@ -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.projectMenu) {
12
14
  return;
13
15
  }
16
+ const items = (0, normalize_module_1.normalizeToArray)(config.projectMenu);
17
+ const isSingle = items.length === 1;
14
18
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
- app.use('/project-menu', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectMenu.key }), (0, render_ui_module_1.default)(config.projectMenu, 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: 'project-menu', item, index, isSingle });
21
+ const basePath = isSingle ? '/project-menu' : `/project-menu-${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
  }
@@ -7,10 +7,24 @@ 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.projectMenuCrowdsource) {
12
14
  return;
13
15
  }
16
+ const items = (0, normalize_module_1.normalizeToArray)(config.projectMenuCrowdsource);
17
+ const isSingle = items.length === 1;
14
18
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
15
- app.use('/project-menu-crowdsource', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectMenuCrowdsource.key }), (0, render_ui_module_1.default)(config.projectMenuCrowdsource, 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)({
21
+ identifier: config.identifier,
22
+ suffix: 'project-menu-crowdsource',
23
+ item,
24
+ index,
25
+ isSingle,
26
+ });
27
+ const basePath = isSingle ? '/project-menu-crowdsource' : `/project-menu-crowdsource-${key}`;
28
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
29
+ }
16
30
  }
@@ -8,11 +8,20 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  const util_2 = require("../../util");
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.projectReports) {
13
15
  return;
14
16
  }
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.projectReports);
18
+ const isSingle = items.length === 1;
15
19
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
16
- app.use('/logo/reports', (0, util_2.serveLogo)(config, config.projectReports));
17
- app.use('/reports', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectReports.key }), (0, render_ui_module_1.default)(config.projectReports, config));
20
+ for (const [index, item] of items.entries()) {
21
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'project-reports', item, index, isSingle });
22
+ const basePath = isSingle ? '/reports' : `/reports-${key}`;
23
+ const logoPath = isSingle ? '/logo/reports' : `/logo/reports-${key}`;
24
+ app.use(logoPath, (0, util_2.serveLogo)(config, item));
25
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
26
+ }
18
27
  }
@@ -8,11 +8,20 @@ const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
10
  const util_2 = require("../../util");
11
+ const normalize_module_1 = require("../../util/normalize-module");
11
12
  function register({ config, app }) {
13
+ var _a;
12
14
  if (!config.projectTools) {
13
15
  return;
14
16
  }
17
+ const items = (0, normalize_module_1.normalizeToArray)(config.projectTools);
18
+ const isSingle = items.length === 1;
15
19
  const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
16
- app.use('/logo/tools', (0, util_2.serveLogo)(config, config.projectTools));
17
- app.use('/tools', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.projectTools.key }), (0, render_ui_module_1.default)(config.projectTools, config));
20
+ for (const [index, item] of items.entries()) {
21
+ const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'tools', item, index, isSingle });
22
+ const basePath = isSingle ? '/tools' : `/tools-${key}`;
23
+ const logoPath = isSingle ? '/logo/tools' : `/logo/tools-${key}`;
24
+ app.use(logoPath, (0, util_2.serveLogo)(config, item));
25
+ app.use(basePath, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: key }), (0, render_ui_module_1.default)(item, config));
26
+ }
18
27
  }
package/out/types.d.ts CHANGED
@@ -127,47 +127,47 @@ export interface ClientConfig extends ImagePath {
127
127
  /**
128
128
  * custom file format module logic
129
129
  */
130
- customFileFormat?: CustomFileFormatLogic;
130
+ customFileFormat?: OneOrMany<CustomFileFormatLogic>;
131
131
  /**
132
132
  * custom MT module logic
133
133
  */
134
- customMT?: CustomMTLogic & ImagePath & Environments;
134
+ customMT?: OneOrMany<CustomMTLogic & ImagePath & Environments>;
135
135
  /**
136
136
  * resources module
137
137
  */
138
- profileResourcesMenu?: UiModule & ImagePath & Environments;
138
+ profileResourcesMenu?: OneOrMany<UiModule & ImagePath & Environments>;
139
139
  /**
140
140
  * profile-settings-menu module
141
141
  */
142
- profileSettingsMenu?: UiModule & ImagePath & Environments;
142
+ profileSettingsMenu?: OneOrMany<UiModule & ImagePath & Environments>;
143
143
  /**
144
144
  * organization-menu module
145
145
  */
146
- organizationMenu?: UiModule & ImagePath;
146
+ organizationMenu?: OneOrMany<UiModule & ImagePath>;
147
147
  /**
148
148
  * organization-settings-menu module
149
149
  */
150
- organizationSettingsMenu?: UiModule & ImagePath;
150
+ organizationSettingsMenu?: OneOrMany<UiModule & ImagePath>;
151
151
  /**
152
152
  * editor-right-panel module
153
153
  */
154
- editorRightPanel?: EditorPanels & Environments;
154
+ editorRightPanel?: OneOrMany<EditorPanels & Environments>;
155
155
  /**
156
156
  * project menu module
157
157
  */
158
- projectMenu?: UiModule & Environments;
158
+ projectMenu?: OneOrMany<UiModule & Environments>;
159
159
  /**
160
160
  * project menu crowdsource module
161
161
  */
162
- projectMenuCrowdsource?: UiModule;
162
+ projectMenuCrowdsource?: OneOrMany<UiModule>;
163
163
  /**
164
164
  * tools module
165
165
  */
166
- projectTools?: UiModule & ImagePath & Environments;
166
+ projectTools?: OneOrMany<UiModule & ImagePath & Environments>;
167
167
  /**
168
168
  * reports module
169
169
  */
170
- projectReports?: UiModule & ImagePath;
170
+ projectReports?: OneOrMany<UiModule & ImagePath>;
171
171
  /**
172
172
  * API module
173
173
  */
@@ -175,11 +175,11 @@ export interface ClientConfig extends ImagePath {
175
175
  /**
176
176
  * context menu module
177
177
  */
178
- contextMenu?: ContextModule | ContextModule[];
178
+ contextMenu?: OneOrMany<ContextModule>;
179
179
  /**
180
180
  * modal module
181
181
  */
182
- modal?: ModalModule | ModalModule[];
182
+ modal?: OneOrMany<ModalModule>;
183
183
  /**
184
184
  * Install hook
185
185
  */
@@ -225,11 +225,11 @@ export interface ClientConfig extends ImagePath {
225
225
  * Configuration of app pricing
226
226
  */
227
227
  pricing?: Pricing;
228
- filePreImport?: FilePreImportLogic;
229
- filePostImport?: FilePostImportLogic;
230
- filePreExport?: FilePreExportLogic;
231
- filePostExport?: FilePostExportLogic;
232
- fileTranslationsAlignmentExport?: TranslationsAlignmentLogic;
228
+ filePreImport?: OneOrMany<FilePreImportLogic>;
229
+ filePostImport?: OneOrMany<FilePostImportLogic>;
230
+ filePreExport?: OneOrMany<FilePreExportLogic>;
231
+ filePostExport?: OneOrMany<FilePostExportLogic>;
232
+ fileTranslationsAlignmentExport?: OneOrMany<TranslationsAlignmentLogic>;
233
233
  /**
234
234
  * Disable formatting logs
235
235
  */
@@ -240,51 +240,51 @@ export interface ClientConfig extends ImagePath {
240
240
  * Not necessary to configure if environment variables AWS_REGION and AWS_TMP_BUCKET_NAME are properly set.
241
241
  */
242
242
  awsConfig?: AWSConfig;
243
- customSpellchecker?: CustomSpellcheckerModule;
243
+ customSpellchecker?: OneOrMany<CustomSpellcheckerModule>;
244
244
  /**
245
245
  * ai provider module
246
246
  */
247
- aiProvider?: AiProviderModule & ImagePath;
247
+ aiProvider?: OneOrMany<AiProviderModule & ImagePath>;
248
248
  /**
249
249
  * ai prompt provider module
250
250
  */
251
- aiPromptProvider?: AiPromptProviderModule & ImagePath;
251
+ aiPromptProvider?: OneOrMany<AiPromptProviderModule & ImagePath>;
252
252
  /**
253
253
  * ai request pre-compile processor module
254
254
  */
255
- aiRequestPreCompile?: AiRequestProcessorModule;
255
+ aiRequestPreCompile?: OneOrMany<AiRequestProcessorModule>;
256
256
  /**
257
257
  * ai request post-compile processor module
258
258
  */
259
- aiRequestPostCompile?: AiRequestProcessorModule;
259
+ aiRequestPostCompile?: OneOrMany<AiRequestProcessorModule>;
260
260
  /**
261
261
  * ai request pre-parse processor module
262
262
  */
263
- aiRequestPreParse?: AiStreamProcessorModule;
263
+ aiRequestPreParse?: OneOrMany<AiStreamProcessorModule>;
264
264
  /**
265
265
  * ai request post-parse processor module
266
266
  */
267
- aiRequestPostParse?: AiRequestProcessorModule;
267
+ aiRequestPostParse?: OneOrMany<AiRequestProcessorModule>;
268
268
  /**
269
269
  * AI tool_calls modules
270
270
  */
271
- aiTools?: AiTool | AiTool[];
271
+ aiTools?: OneOrMany<AiTool>;
272
272
  /**
273
273
  * AI tool_calls modules with UI widgets
274
274
  */
275
- aiToolsWidget?: AiToolWidget | AiToolWidget[];
275
+ aiToolsWidget?: OneOrMany<AiToolWidget>;
276
276
  /**
277
277
  * qa check module
278
278
  */
279
- externalQaCheck?: ExternalQaCheckModule & ImagePath;
279
+ externalQaCheck?: OneOrMany<ExternalQaCheckModule & ImagePath>;
280
280
  /**
281
281
  * webhook modules
282
282
  */
283
- webhooks?: Webhook | Webhook[];
283
+ webhooks?: OneOrMany<Webhook>;
284
284
  /**
285
285
  * workflow step modules
286
286
  */
287
- workflowStepType?: WorkflowStepTypeModule | WorkflowStepTypeModule[];
287
+ workflowStepType?: OneOrMany<WorkflowStepTypeModule>;
288
288
  /**
289
289
  * property that tells backend that AiProvider and AiPromptProvider modules can cooperate only with each one
290
290
  */
@@ -296,11 +296,11 @@ export interface ClientConfig extends ImagePath {
296
296
  /**
297
297
  * Automation action module
298
298
  */
299
- automationAction?: AutomationActionModule | AutomationActionModule[];
299
+ automationAction?: OneOrMany<AutomationActionModule>;
300
300
  /**
301
301
  * Auth guard module for custom authentication/authorization checks
302
302
  */
303
- authGuard?: AuthGuardModule | AuthGuardModule[];
303
+ authGuard?: OneOrMany<AuthGuardModule>;
304
304
  /**
305
305
  * custom file storage
306
306
  */
@@ -317,7 +317,7 @@ export interface AssetsConfig {
317
317
  fetcher: Fetcher;
318
318
  }
319
319
  export interface Environments {
320
- environments?: Environment | Environment[];
320
+ environments?: OneOrMany<Environment>;
321
321
  }
322
322
  type Environment = 'crowdin' | 'crowdin-enterprise';
323
323
  export type Config = ClientConfig & {
@@ -519,6 +519,7 @@ export interface ModuleKey {
519
519
  */
520
520
  key?: string;
521
521
  }
522
+ export type OneOrMany<T> = T | T[];
522
523
  export interface ImagePath {
523
524
  /**
524
525
  * path to app logo (e.g. {@example join(__dirname, 'logo.png')})
@@ -0,0 +1,11 @@
1
+ export declare function normalizeToArray<T>(value: T | T[]): T[];
2
+ export declare function resolveInstanceKey({ identifier, suffix, item, index, isSingle, }: {
3
+ identifier: string;
4
+ suffix: string;
5
+ item: {
6
+ key?: string;
7
+ name?: string;
8
+ };
9
+ index: number;
10
+ isSingle: boolean;
11
+ }): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeToArray = normalizeToArray;
4
+ exports.resolveInstanceKey = resolveInstanceKey;
5
+ const index_1 = require("./index");
6
+ function normalizeToArray(value) {
7
+ return Array.isArray(value) ? value : [value];
8
+ }
9
+ function resolveInstanceKey({ identifier, suffix, item, index, isSingle, }) {
10
+ if (isSingle) {
11
+ return identifier + '-' + suffix;
12
+ }
13
+ if (item.key) {
14
+ return item.key;
15
+ }
16
+ if (item.name) {
17
+ return identifier + '-' + (0, index_1.kebabCase)(item.name);
18
+ }
19
+ return identifier + '-' + suffix + '-' + index;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdin/app-project-module",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",