@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.
- package/out/index.js +10 -1
- package/out/modules/ai-prompt-provider/index.js +24 -9
- package/out/modules/ai-provider/index.js +46 -27
- package/out/modules/ai-request-processors/index.js +18 -8
- package/out/modules/context-menu/types.d.ts +1 -0
- package/out/modules/context-menu/types.js +1 -0
- package/out/modules/custom-mt/index.js +30 -16
- package/out/modules/custom-spell-check/index.js +66 -36
- package/out/modules/editor-right-panel/index.js +9 -1
- package/out/modules/external-qa-check/index.js +42 -26
- package/out/modules/file-processing/index.js +116 -65
- package/out/modules/manifest.js +487 -198
- package/out/modules/organization-menu/index.js +18 -6
- package/out/modules/organization-settings-menu/index.js +24 -6
- package/out/modules/profile-resources-menu/index.js +24 -6
- package/out/modules/profile-settings-menu/index.js +24 -6
- package/out/modules/project-menu/index.js +9 -1
- package/out/modules/project-menu-crowdsource/index.js +15 -1
- package/out/modules/project-reports/index.js +11 -2
- package/out/modules/project-tools/index.js +11 -2
- package/out/types.d.ts +34 -33
- package/out/util/normalize-module.d.ts +11 -0
- package/out/util/normalize-module.js +20 -0
- package/package.json +1 -1
package/out/modules/manifest.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.default = handle;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
const util_1 = require("../util");
|
|
6
6
|
const subscription_1 = require("../util/subscription");
|
|
7
|
+
const normalize_module_1 = require("../util/normalize-module");
|
|
7
8
|
const api_1 = require("./api/api");
|
|
8
9
|
const util_2 = require("./ai-tools/util");
|
|
9
10
|
const util_3 = require("./workflow-step-type/util");
|
|
@@ -16,7 +17,7 @@ function normalizeEnvironments(environments) {
|
|
|
16
17
|
return [environments];
|
|
17
18
|
}
|
|
18
19
|
function handle(config) {
|
|
19
|
-
var _a, _b
|
|
20
|
+
var _a, _b;
|
|
20
21
|
const modules = {};
|
|
21
22
|
if (config.projectIntegration) {
|
|
22
23
|
// prevent possible overrides of the other modules
|
|
@@ -28,190 +29,398 @@ function handle(config) {
|
|
|
28
29
|
];
|
|
29
30
|
}
|
|
30
31
|
if (config.customFileFormat) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
if (Array.isArray(config.customFileFormat)) {
|
|
33
|
+
config.customFileFormat = config.customFileFormat.map((item) => (Object.assign({}, item)));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
config.customFileFormat = Object.assign({}, config.customFileFormat);
|
|
37
|
+
}
|
|
38
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.customFileFormat);
|
|
39
|
+
const isSingle = items.length === 1;
|
|
40
|
+
modules['custom-file-format'] = items.map((item, index) => {
|
|
41
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'ff', item, index, isSingle });
|
|
42
|
+
item.key = key;
|
|
43
|
+
return {
|
|
44
|
+
key,
|
|
45
|
+
type: item.type,
|
|
46
|
+
stringsExport: !!item.stringsExport,
|
|
47
|
+
multilingual: !!item.multilingual,
|
|
48
|
+
customSrxSupported: !!item.customSrxSupported,
|
|
49
|
+
extensions: item.extensions,
|
|
50
|
+
signaturePatterns: item.signaturePatterns,
|
|
51
|
+
multilingualExport: item.multilingualExport,
|
|
52
|
+
url: isSingle ? '/file/process' : `/file/${key}/process`,
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
config.customFileFormat = isSingle ? items[0] : items;
|
|
46
56
|
}
|
|
47
57
|
if (config.filePreImport) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]
|
|
58
|
+
if (Array.isArray(config.filePreImport)) {
|
|
59
|
+
config.filePreImport = config.filePreImport.map((item) => (Object.assign({}, item)));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
config.filePreImport = Object.assign({}, config.filePreImport);
|
|
63
|
+
}
|
|
64
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePreImport);
|
|
65
|
+
const isSingle = items.length === 1;
|
|
66
|
+
modules['file-pre-import'] = items.map((item, index) => {
|
|
67
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'pri', item, index, isSingle });
|
|
68
|
+
item.key = key;
|
|
69
|
+
return {
|
|
70
|
+
key,
|
|
71
|
+
signaturePatterns: item.signaturePatterns,
|
|
72
|
+
url: isSingle ? '/pre-import' : `/pre-import/${key}`,
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
config.filePreImport = isSingle ? items[0] : items;
|
|
57
76
|
}
|
|
58
77
|
if (config.filePostImport) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
]
|
|
78
|
+
if (Array.isArray(config.filePostImport)) {
|
|
79
|
+
config.filePostImport = config.filePostImport.map((item) => (Object.assign({}, item)));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
config.filePostImport = Object.assign({}, config.filePostImport);
|
|
83
|
+
}
|
|
84
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePostImport);
|
|
85
|
+
const isSingle = items.length === 1;
|
|
86
|
+
modules['file-post-import'] = items.map((item, index) => {
|
|
87
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'poi', item, index, isSingle });
|
|
88
|
+
item.key = key;
|
|
89
|
+
return {
|
|
90
|
+
key,
|
|
91
|
+
signaturePatterns: item.signaturePatterns,
|
|
92
|
+
url: isSingle ? '/post-import' : `/post-import/${key}`,
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
config.filePostImport = isSingle ? items[0] : items;
|
|
68
96
|
}
|
|
69
97
|
if (config.filePreExport) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
]
|
|
98
|
+
if (Array.isArray(config.filePreExport)) {
|
|
99
|
+
config.filePreExport = config.filePreExport.map((item) => (Object.assign({}, item)));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
config.filePreExport = Object.assign({}, config.filePreExport);
|
|
103
|
+
}
|
|
104
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePreExport);
|
|
105
|
+
const isSingle = items.length === 1;
|
|
106
|
+
modules['file-pre-export'] = items.map((item, index) => {
|
|
107
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'pre', item, index, isSingle });
|
|
108
|
+
item.key = key;
|
|
109
|
+
return {
|
|
110
|
+
key,
|
|
111
|
+
signaturePatterns: item.signaturePatterns,
|
|
112
|
+
url: isSingle ? '/pre-export' : `/pre-export/${key}`,
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
config.filePreExport = isSingle ? items[0] : items;
|
|
79
116
|
}
|
|
80
117
|
if (config.filePostExport) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
]
|
|
118
|
+
if (Array.isArray(config.filePostExport)) {
|
|
119
|
+
config.filePostExport = config.filePostExport.map((item) => (Object.assign({}, item)));
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
config.filePostExport = Object.assign({}, config.filePostExport);
|
|
123
|
+
}
|
|
124
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePostExport);
|
|
125
|
+
const isSingle = items.length === 1;
|
|
126
|
+
modules['file-post-export'] = items.map((item, index) => {
|
|
127
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'poe', item, index, isSingle });
|
|
128
|
+
item.key = key;
|
|
129
|
+
return {
|
|
130
|
+
key,
|
|
131
|
+
signaturePatterns: item.signaturePatterns,
|
|
132
|
+
url: isSingle ? '/post-export' : `/post-export/${key}`,
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
config.filePostExport = isSingle ? items[0] : items;
|
|
90
136
|
}
|
|
91
137
|
if (config.fileTranslationsAlignmentExport) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
]
|
|
138
|
+
if (Array.isArray(config.fileTranslationsAlignmentExport)) {
|
|
139
|
+
config.fileTranslationsAlignmentExport = config.fileTranslationsAlignmentExport.map((item) => (Object.assign({}, item)));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
config.fileTranslationsAlignmentExport = Object.assign({}, config.fileTranslationsAlignmentExport);
|
|
143
|
+
}
|
|
144
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.fileTranslationsAlignmentExport);
|
|
145
|
+
const isSingle = items.length === 1;
|
|
146
|
+
modules['file-translations-alignment'] = items.map((item, index) => {
|
|
147
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'ftae', item, index, isSingle });
|
|
148
|
+
item.key = key;
|
|
149
|
+
return {
|
|
150
|
+
key,
|
|
151
|
+
signaturePatterns: item.signaturePatterns,
|
|
152
|
+
url: isSingle ? '/translations-alignment' : `/translations-alignment/${key}`,
|
|
153
|
+
};
|
|
154
|
+
});
|
|
155
|
+
config.fileTranslationsAlignmentExport = isSingle ? items[0] : items;
|
|
101
156
|
}
|
|
102
157
|
if (config.customMT) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}))
|
|
115
|
-
|
|
158
|
+
if (Array.isArray(config.customMT)) {
|
|
159
|
+
config.customMT = config.customMT.map((item) => (Object.assign({}, item)));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
config.customMT = Object.assign({}, config.customMT);
|
|
163
|
+
}
|
|
164
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.customMT);
|
|
165
|
+
const isSingle = items.length === 1;
|
|
166
|
+
modules['custom-mt'] = items.map((item, index) => {
|
|
167
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'mt', item, index, isSingle });
|
|
168
|
+
item.key = key;
|
|
169
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ key, name: config.name, logo: (0, util_1.getLogoUrl)(config, item, isSingle ? '/mt' : `/mt-${key}`), url: isSingle ? '/mt/translate' : `/mt/${key}/translate`, withContext: !!item.withContext }, ((0, util_1.isDefined)(item.splitStringsIntoChunks) && {
|
|
170
|
+
splitStringsIntoChunks: item.splitStringsIntoChunks,
|
|
171
|
+
})), ((0, util_1.isDefined)(item.batchSize) && {
|
|
172
|
+
batchSize: item.batchSize,
|
|
173
|
+
})), ((0, util_1.isDefined)(item.maskEntities) && {
|
|
174
|
+
maskEntities: item.maskEntities,
|
|
175
|
+
})), (!!item.environments && {
|
|
176
|
+
environments: normalizeEnvironments(item.environments),
|
|
177
|
+
}));
|
|
178
|
+
});
|
|
179
|
+
config.customMT = isSingle ? items[0] : items;
|
|
116
180
|
}
|
|
117
181
|
if (config.organizationMenu) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
182
|
+
if (Array.isArray(config.organizationMenu)) {
|
|
183
|
+
config.organizationMenu = config.organizationMenu.map((item) => (Object.assign({}, item)));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
config.organizationMenu = Object.assign({}, config.organizationMenu);
|
|
187
|
+
}
|
|
188
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.organizationMenu);
|
|
189
|
+
const isSingle = items.length === 1;
|
|
190
|
+
modules['organization-menu'] = items.map((item, index) => {
|
|
191
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
192
|
+
identifier: config.identifier,
|
|
193
|
+
suffix: 'resources',
|
|
194
|
+
item,
|
|
195
|
+
index,
|
|
196
|
+
isSingle,
|
|
197
|
+
});
|
|
198
|
+
item.key = key;
|
|
199
|
+
const basePath = isSingle ? '/organization-menu' : `/organization-menu-${key}`;
|
|
200
|
+
return {
|
|
201
|
+
key,
|
|
202
|
+
name: item.name || config.name,
|
|
203
|
+
url: basePath + '/' + (item.fileName || 'index.html'),
|
|
204
|
+
icon: (0, util_1.getLogoUrl)(config, item, isSingle ? '/resources' : `/organization-menu-${key}`),
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
config.organizationMenu = isSingle ? items[0] : items;
|
|
128
208
|
}
|
|
129
209
|
if (config.organizationSettingsMenu) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
210
|
+
if (Array.isArray(config.organizationSettingsMenu)) {
|
|
211
|
+
config.organizationSettingsMenu = config.organizationSettingsMenu.map((item) => (Object.assign({}, item)));
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
config.organizationSettingsMenu = Object.assign({}, config.organizationSettingsMenu);
|
|
215
|
+
}
|
|
216
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.organizationSettingsMenu);
|
|
217
|
+
const isSingle = items.length === 1;
|
|
218
|
+
modules['organization-settings-menu'] = items.map((item, index) => {
|
|
219
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
220
|
+
identifier: config.identifier,
|
|
221
|
+
suffix: 'organization-settings-menu',
|
|
222
|
+
item,
|
|
223
|
+
index,
|
|
224
|
+
isSingle,
|
|
225
|
+
});
|
|
226
|
+
item.key = key;
|
|
227
|
+
const basePath = isSingle ? '/organization-settings' : `/organization-settings-${key}`;
|
|
228
|
+
return {
|
|
229
|
+
key,
|
|
230
|
+
name: item.name || config.name,
|
|
231
|
+
url: basePath + '/' + (item.fileName || 'index.html'),
|
|
232
|
+
icon: (0, util_1.getLogoUrl)(config, item, isSingle ? '/organization-settings' : `/organization-settings-${key}`),
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
config.organizationSettingsMenu = isSingle ? items[0] : items;
|
|
140
236
|
}
|
|
141
237
|
if (config.profileResourcesMenu) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
238
|
+
if (Array.isArray(config.profileResourcesMenu)) {
|
|
239
|
+
config.profileResourcesMenu = config.profileResourcesMenu.map((item) => (Object.assign({}, item)));
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
config.profileResourcesMenu = Object.assign({}, config.profileResourcesMenu);
|
|
243
|
+
}
|
|
244
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.profileResourcesMenu);
|
|
245
|
+
const isSingle = items.length === 1;
|
|
246
|
+
modules['profile-resources-menu'] = items.map((item, index) => {
|
|
247
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
248
|
+
identifier: config.identifier,
|
|
249
|
+
suffix: 'profile-resources-menu',
|
|
250
|
+
item,
|
|
251
|
+
index,
|
|
252
|
+
isSingle,
|
|
253
|
+
});
|
|
254
|
+
item.key = key;
|
|
255
|
+
const basePath = isSingle ? '/profile-resources' : `/profile-resources-${key}`;
|
|
256
|
+
return Object.assign({ key, name: item.name || config.name, url: basePath + '/' + (item.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config, item, isSingle ? '/profile-resources' : `/profile-resources-${key}`) }, (!!item.environments && {
|
|
257
|
+
environments: normalizeEnvironments(item.environments),
|
|
258
|
+
}));
|
|
259
|
+
});
|
|
260
|
+
config.profileResourcesMenu = isSingle ? items[0] : items;
|
|
149
261
|
}
|
|
150
262
|
if (config.profileSettingsMenu) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
263
|
+
if (Array.isArray(config.profileSettingsMenu)) {
|
|
264
|
+
config.profileSettingsMenu = config.profileSettingsMenu.map((item) => (Object.assign({}, item)));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
config.profileSettingsMenu = Object.assign({}, config.profileSettingsMenu);
|
|
268
|
+
}
|
|
269
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.profileSettingsMenu);
|
|
270
|
+
const isSingle = items.length === 1;
|
|
271
|
+
modules['profile-settings-menu'] = items.map((item, index) => {
|
|
272
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
273
|
+
identifier: config.identifier,
|
|
274
|
+
suffix: 'profile-settings-menu',
|
|
275
|
+
item,
|
|
276
|
+
index,
|
|
277
|
+
isSingle,
|
|
278
|
+
});
|
|
279
|
+
item.key = key;
|
|
280
|
+
const basePath = isSingle ? '/profile-settings' : `/profile-settings-${key}`;
|
|
281
|
+
return Object.assign({ key, name: item.name || config.name, url: basePath + '/' + (item.fileName || 'index.html'), icon: (0, util_1.getLogoUrl)(config, item, isSingle ? '/profile-settings' : `/profile-settings-${key}`) }, (!!item.environments && {
|
|
282
|
+
environments: normalizeEnvironments(item.environments),
|
|
283
|
+
}));
|
|
284
|
+
});
|
|
285
|
+
config.profileSettingsMenu = isSingle ? items[0] : items;
|
|
158
286
|
}
|
|
159
287
|
if (config.editorRightPanel) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
288
|
+
if (Array.isArray(config.editorRightPanel)) {
|
|
289
|
+
config.editorRightPanel = config.editorRightPanel.map((item) => (Object.assign({}, item)));
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
config.editorRightPanel = Object.assign({}, config.editorRightPanel);
|
|
293
|
+
}
|
|
294
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.editorRightPanel);
|
|
295
|
+
const isSingle = items.length === 1;
|
|
296
|
+
modules['editor-right-panel'] = items.map((item, index) => {
|
|
297
|
+
var _a;
|
|
298
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
299
|
+
identifier: config.identifier,
|
|
300
|
+
suffix: 'editor-panels',
|
|
301
|
+
item,
|
|
302
|
+
index,
|
|
303
|
+
isSingle,
|
|
304
|
+
});
|
|
305
|
+
item.key = key;
|
|
306
|
+
const basePath = isSingle ? '/editor-panels' : `/editor-panels-${key}`;
|
|
307
|
+
return Object.assign({ key, name: item.name || config.name, url: basePath + '/' + (item.fileName || 'index.html'), supportsMultipleStrings: (_a = item.supportsMultipleStrings) !== null && _a !== void 0 ? _a : false, modes: item.modes }, (!!item.environments && {
|
|
308
|
+
environments: normalizeEnvironments(item.environments),
|
|
309
|
+
}));
|
|
310
|
+
});
|
|
311
|
+
config.editorRightPanel = isSingle ? items[0] : items;
|
|
167
312
|
}
|
|
168
313
|
if (config.projectMenu) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
314
|
+
if (Array.isArray(config.projectMenu)) {
|
|
315
|
+
config.projectMenu = config.projectMenu.map((item) => (Object.assign({}, item)));
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
config.projectMenu = Object.assign({}, config.projectMenu);
|
|
319
|
+
}
|
|
320
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.projectMenu);
|
|
321
|
+
const isSingle = items.length === 1;
|
|
322
|
+
modules['project-menu'] = items.map((item, index) => {
|
|
323
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
324
|
+
identifier: config.identifier,
|
|
325
|
+
suffix: 'project-menu',
|
|
326
|
+
item,
|
|
327
|
+
index,
|
|
328
|
+
isSingle,
|
|
329
|
+
});
|
|
330
|
+
item.key = key;
|
|
331
|
+
const basePath = isSingle ? '/project-menu' : `/project-menu-${key}`;
|
|
332
|
+
return Object.assign({ key, name: item.name || config.name, url: basePath + '/' + (item.fileName || 'index.html') }, (!!item.environments && {
|
|
333
|
+
environments: normalizeEnvironments(item.environments),
|
|
334
|
+
}));
|
|
335
|
+
});
|
|
336
|
+
config.projectMenu = isSingle ? items[0] : items;
|
|
176
337
|
}
|
|
177
338
|
if (config.projectMenuCrowdsource) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
]
|
|
339
|
+
if (Array.isArray(config.projectMenuCrowdsource)) {
|
|
340
|
+
config.projectMenuCrowdsource = config.projectMenuCrowdsource.map((item) => (Object.assign({}, item)));
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
config.projectMenuCrowdsource = Object.assign({}, config.projectMenuCrowdsource);
|
|
344
|
+
}
|
|
345
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.projectMenuCrowdsource);
|
|
346
|
+
const isSingle = items.length === 1;
|
|
347
|
+
modules['project-menu-crowdsource'] = items.map((item, index) => {
|
|
348
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
349
|
+
identifier: config.identifier,
|
|
350
|
+
suffix: 'project-menu-crowdsource',
|
|
351
|
+
item,
|
|
352
|
+
index,
|
|
353
|
+
isSingle,
|
|
354
|
+
});
|
|
355
|
+
item.key = key;
|
|
356
|
+
const basePath = isSingle ? '/project-menu-crowdsource' : `/project-menu-crowdsource-${key}`;
|
|
357
|
+
return {
|
|
358
|
+
key,
|
|
359
|
+
name: item.name || config.name,
|
|
360
|
+
url: basePath + '/' + (item.fileName || 'index.html'),
|
|
361
|
+
};
|
|
362
|
+
});
|
|
363
|
+
config.projectMenuCrowdsource = isSingle ? items[0] : items;
|
|
187
364
|
}
|
|
188
365
|
if (config.projectTools) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
366
|
+
if (Array.isArray(config.projectTools)) {
|
|
367
|
+
config.projectTools = config.projectTools.map((item) => (Object.assign({}, item)));
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
config.projectTools = Object.assign({}, config.projectTools);
|
|
371
|
+
}
|
|
372
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.projectTools);
|
|
373
|
+
const isSingle = items.length === 1;
|
|
374
|
+
modules['project-tools'] = items.map((item, index) => {
|
|
375
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
376
|
+
identifier: config.identifier,
|
|
377
|
+
suffix: 'tools',
|
|
378
|
+
item,
|
|
379
|
+
index,
|
|
380
|
+
isSingle,
|
|
381
|
+
});
|
|
382
|
+
item.key = key;
|
|
383
|
+
const basePath = isSingle ? '/tools' : `/tools-${key}`;
|
|
384
|
+
return Object.assign({ key, name: item.name || config.name, description: config.description, logo: (0, util_1.getLogoUrl)(config, item, isSingle ? '/tools' : `/tools-${key}`), url: basePath + '/' + (item.fileName || 'index.html') }, (!!item.environments && {
|
|
385
|
+
environments: normalizeEnvironments(item.environments),
|
|
386
|
+
}));
|
|
387
|
+
});
|
|
388
|
+
config.projectTools = isSingle ? items[0] : items;
|
|
196
389
|
}
|
|
197
390
|
if (config.projectReports) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
391
|
+
if (Array.isArray(config.projectReports)) {
|
|
392
|
+
config.projectReports = config.projectReports.map((item) => (Object.assign({}, item)));
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
config.projectReports = Object.assign({}, config.projectReports);
|
|
396
|
+
}
|
|
397
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.projectReports);
|
|
398
|
+
const isSingle = items.length === 1;
|
|
399
|
+
modules['project-reports'] = items.map((item, index) => {
|
|
400
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
401
|
+
identifier: config.identifier,
|
|
402
|
+
suffix: 'project-reports',
|
|
403
|
+
item,
|
|
404
|
+
index,
|
|
405
|
+
isSingle,
|
|
406
|
+
});
|
|
407
|
+
item.key = key;
|
|
408
|
+
const basePath = isSingle ? '/reports' : `/reports-${key}`;
|
|
409
|
+
return {
|
|
410
|
+
key,
|
|
411
|
+
name: item.name || config.name,
|
|
204
412
|
description: config.description,
|
|
205
|
-
logo: (0, util_1.getLogoUrl)(config,
|
|
206
|
-
url: '/
|
|
207
|
-
}
|
|
208
|
-
|
|
413
|
+
logo: (0, util_1.getLogoUrl)(config, item, isSingle ? '/reports' : `/reports-${key}`),
|
|
414
|
+
url: basePath + '/' + (item.fileName || 'index.html'),
|
|
415
|
+
};
|
|
416
|
+
});
|
|
417
|
+
config.projectReports = isSingle ? items[0] : items;
|
|
209
418
|
}
|
|
210
419
|
if (config.modal) {
|
|
211
420
|
let modals = [];
|
|
212
421
|
if (Array.isArray(config.modal)) {
|
|
213
|
-
modals = config.modal.map((modal,
|
|
214
|
-
const moduleKey = modal.key || `${config.identifier}-modal-${
|
|
422
|
+
modals = config.modal.map((modal, index) => {
|
|
423
|
+
const moduleKey = modal.key || `${config.identifier}-modal-${index}`;
|
|
215
424
|
return Object.assign({ key: moduleKey, name: modal.name || config.name, url: modal.url || `/modal-${moduleKey}/` + (modal.fileName || 'index.html') }, (!!modal.environments && { environments: normalizeEnvironments(modal.environments) }));
|
|
216
425
|
});
|
|
217
426
|
}
|
|
@@ -227,8 +436,8 @@ function handle(config) {
|
|
|
227
436
|
if (config.contextMenu) {
|
|
228
437
|
let contextMenus = [];
|
|
229
438
|
if (Array.isArray(config.contextMenu)) {
|
|
230
|
-
contextMenus = config.contextMenu.map((contextMenu,
|
|
231
|
-
const moduleKey = contextMenu.key || `${config.identifier}-context-menu-${
|
|
439
|
+
contextMenus = config.contextMenu.map((contextMenu, index) => {
|
|
440
|
+
const moduleKey = contextMenu.key || `${config.identifier}-context-menu-${index}`;
|
|
232
441
|
return Object.assign({ key: moduleKey, name: contextMenu.name || config.name, description: config.description, options: Object.assign(Object.assign({ location: contextMenu.location, type: contextMenu.type }, (contextMenu.module && contextMenu.moduleKey
|
|
233
442
|
? {
|
|
234
443
|
module: {
|
|
@@ -259,57 +468,121 @@ function handle(config) {
|
|
|
259
468
|
modules['api'] = (0, api_1.getApiManifest)(config, config.api);
|
|
260
469
|
}
|
|
261
470
|
if (config.customSpellchecker) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
471
|
+
if (Array.isArray(config.customSpellchecker)) {
|
|
472
|
+
config.customSpellchecker = config.customSpellchecker.map((item) => (Object.assign({}, item)));
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
config.customSpellchecker = Object.assign({}, config.customSpellchecker);
|
|
476
|
+
}
|
|
477
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.customSpellchecker);
|
|
478
|
+
const isSingle = items.length === 1;
|
|
479
|
+
modules['custom-spellchecker'] = items.map((item, index) => {
|
|
480
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
481
|
+
identifier: config.identifier,
|
|
482
|
+
suffix: 'spellchecker',
|
|
483
|
+
item,
|
|
484
|
+
index,
|
|
485
|
+
isSingle,
|
|
486
|
+
});
|
|
487
|
+
item.key = key;
|
|
488
|
+
const base = isSingle ? '/spellchecker' : `/spellchecker/${key}`;
|
|
489
|
+
const uiModule = item.settingsUiModule;
|
|
490
|
+
return Object.assign(Object.assign({ key, name: item.name || config.name, description: item.description || config.description, listSupportedLanguagesUrl: `${base}/languages`, checkSpellingUrl: `${base}/spellcheck` }, (!!item.environments && {
|
|
491
|
+
environments: normalizeEnvironments(item.environments),
|
|
492
|
+
})), (uiModule ? { url: `${base}/settings/` + (uiModule.fileName || 'index.html') } : {}));
|
|
493
|
+
});
|
|
494
|
+
config.customSpellchecker = isSingle ? items[0] : items;
|
|
270
495
|
}
|
|
271
496
|
if (config.aiProvider) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
497
|
+
if (Array.isArray(config.aiProvider)) {
|
|
498
|
+
config.aiProvider = config.aiProvider.map((item) => (Object.assign({}, item)));
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
config.aiProvider = Object.assign({}, config.aiProvider);
|
|
502
|
+
}
|
|
503
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.aiProvider);
|
|
504
|
+
const isSingle = items.length === 1;
|
|
505
|
+
modules['ai-provider'] = items.map((item, index) => {
|
|
506
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
507
|
+
identifier: config.identifier,
|
|
508
|
+
suffix: 'aiprovider',
|
|
509
|
+
item,
|
|
510
|
+
index,
|
|
511
|
+
isSingle,
|
|
512
|
+
});
|
|
513
|
+
item.key = key;
|
|
514
|
+
const base = isSingle ? '/ai-provider' : `/ai-provider/${key}`;
|
|
515
|
+
const logoPath = isSingle ? '/aiprovider' : `/aiprovider-${key}`;
|
|
516
|
+
const settingsBase = isSingle ? '' : `/${key}`;
|
|
517
|
+
const uiModule = item.settingsUiModule;
|
|
518
|
+
return Object.assign(Object.assign({ key, name: item.name || config.name, description: item.description || config.description, logo: (0, util_1.getLogoUrl)(config, item, logoPath), chatCompletionsUrl: `${base}/completions`, modelsUrl: `${base}/models` }, (!!item.environments && {
|
|
519
|
+
environments: normalizeEnvironments(item.environments),
|
|
520
|
+
})), (uiModule ? { url: `/settings${settingsBase}/` + (uiModule.fileName || 'index.html') } : {}));
|
|
521
|
+
});
|
|
522
|
+
config.aiProvider = isSingle ? items[0] : items;
|
|
280
523
|
}
|
|
281
524
|
[
|
|
282
525
|
...Object.values(ai_request_processors_1.AiRequestProcessorModuleWithoutStream),
|
|
283
526
|
...Object.values(ai_request_processors_1.AiRequestProcessorModuleWithStream),
|
|
284
527
|
].forEach((moduleType) => {
|
|
285
|
-
const
|
|
286
|
-
if (!
|
|
528
|
+
const moduleValue = config[moduleType];
|
|
529
|
+
if (!moduleValue) {
|
|
287
530
|
return;
|
|
288
531
|
}
|
|
289
532
|
const moduleSlug = (0, ai_request_processors_1.generateModuleSlugFromType)(moduleType);
|
|
290
|
-
|
|
291
|
-
{
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
},
|
|
295
|
-
|
|
533
|
+
if (Array.isArray(moduleValue)) {
|
|
534
|
+
config[moduleType] = moduleValue.map((item) => (Object.assign({}, item)));
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
config[moduleType] = Object.assign({}, moduleValue);
|
|
538
|
+
}
|
|
539
|
+
const items = (0, normalize_module_1.normalizeToArray)(config[moduleType]);
|
|
540
|
+
const isSingle = items.length === 1;
|
|
541
|
+
modules[moduleSlug] = items.map((item, index) => {
|
|
542
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
543
|
+
identifier: config.identifier,
|
|
544
|
+
suffix: moduleSlug,
|
|
545
|
+
item,
|
|
546
|
+
index,
|
|
547
|
+
isSingle,
|
|
548
|
+
});
|
|
549
|
+
item.key = key;
|
|
550
|
+
return {
|
|
551
|
+
key,
|
|
552
|
+
processorUrl: isSingle
|
|
553
|
+
? '/ai-request-processor/' + moduleSlug
|
|
554
|
+
: `/ai-request-processor/${moduleSlug}/${key}`,
|
|
555
|
+
};
|
|
556
|
+
});
|
|
557
|
+
config[moduleType] = isSingle ? items[0] : items;
|
|
296
558
|
});
|
|
297
559
|
if (config.aiPromptProvider) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
560
|
+
if (Array.isArray(config.aiPromptProvider)) {
|
|
561
|
+
config.aiPromptProvider = config.aiPromptProvider.map((item) => (Object.assign({}, item)));
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
config.aiPromptProvider = Object.assign({}, config.aiPromptProvider);
|
|
565
|
+
}
|
|
566
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.aiPromptProvider);
|
|
567
|
+
const isSingle = items.length === 1;
|
|
568
|
+
modules['ai-prompt-provider'] = items.map((item, index) => {
|
|
569
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
570
|
+
identifier: config.identifier,
|
|
571
|
+
suffix: 'ai-prompt-provider',
|
|
572
|
+
item,
|
|
573
|
+
index,
|
|
574
|
+
isSingle,
|
|
575
|
+
});
|
|
576
|
+
item.key = key;
|
|
577
|
+
const base = isSingle ? '/prompt-provider' : `/prompt-provider/${key}`;
|
|
578
|
+
const logoPath = isSingle ? '/ai-prompt-provider' : `/ai-prompt-provider-${key}`;
|
|
579
|
+
return Object.assign(Object.assign(Object.assign({ key, name: item.name || config.name, logo: (0, util_1.getLogoUrl)(config, item, logoPath), compileUrl: `${base}/compile` }, ((0, util_1.isDefined)(item.allowRetryOnQaIssues) && {
|
|
580
|
+
allowRetryOnQaIssues: item.allowRetryOnQaIssues,
|
|
581
|
+
})), (item.actions ? { actions: item.actions } : {})), (item.formSchema || item.uiPath
|
|
582
|
+
? { configuratorUrl: `${base}/settings/` + (item.fileName || 'index.html') }
|
|
583
|
+
: {}));
|
|
584
|
+
});
|
|
585
|
+
config.aiPromptProvider = isSingle ? items[0] : items;
|
|
313
586
|
}
|
|
314
587
|
if (config.aiTools) {
|
|
315
588
|
// prevent possible overrides of the other modules
|
|
@@ -365,12 +638,28 @@ function handle(config) {
|
|
|
365
638
|
}
|
|
366
639
|
}
|
|
367
640
|
if (config.externalQaCheck) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
641
|
+
if (Array.isArray(config.externalQaCheck)) {
|
|
642
|
+
config.externalQaCheck = config.externalQaCheck.map((item) => (Object.assign({}, item)));
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
config.externalQaCheck = Object.assign({}, config.externalQaCheck);
|
|
646
|
+
}
|
|
647
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.externalQaCheck);
|
|
648
|
+
const isSingle = items.length === 1;
|
|
649
|
+
modules['external-qa-check'] = items.map((item, index) => {
|
|
650
|
+
const key = (0, normalize_module_1.resolveInstanceKey)({
|
|
651
|
+
identifier: config.identifier,
|
|
652
|
+
suffix: 'qa-check',
|
|
653
|
+
item,
|
|
654
|
+
index,
|
|
655
|
+
isSingle,
|
|
656
|
+
});
|
|
657
|
+
item.key = key;
|
|
658
|
+
const base = isSingle ? '/qa-check' : `/qa-check/${key}`;
|
|
659
|
+
const uiModule = item.settingsUiModule;
|
|
660
|
+
return Object.assign(Object.assign({ key, name: item.name || config.name, description: item.description || config.description, runQaCheckUrl: `${base}/validate` }, (item.batchSize ? { getBatchSizeUrl: `${base}/batch-size` } : {})), (uiModule ? { url: `${base}/settings/` + (uiModule.fileName || 'index.html') } : {}));
|
|
661
|
+
});
|
|
662
|
+
config.externalQaCheck = isSingle ? items[0] : items;
|
|
374
663
|
}
|
|
375
664
|
if (config.workflowStepType) {
|
|
376
665
|
// prevent possible overrides of the other modules
|
|
@@ -388,7 +677,7 @@ function handle(config) {
|
|
|
388
677
|
if (!workflowStep.key) {
|
|
389
678
|
workflowStep.key = config.identifier + '-' + (0, util_3.getWorkflowStepKey)(workflowStep);
|
|
390
679
|
}
|
|
391
|
-
const uiModule = ((
|
|
680
|
+
const uiModule = ((_a = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _a === void 0 ? void 0 : _a.formSchema) || ((_b = workflowStep === null || workflowStep === void 0 ? void 0 : workflowStep.settingsUiModule) === null || _b === void 0 ? void 0 : _b.fileName);
|
|
392
681
|
modules['workflow-step-type'].push(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ key: workflowStep.key, name: workflowStep.name || config.name }, (workflowStep.imageUrl || workflowStep.imagePath
|
|
393
682
|
? { logo: (0, util_1.getLogoUrl)(config, workflowStep, `-${workflowStep.key}`) }
|
|
394
683
|
: {})), { 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) } : {})));
|