@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
|
@@ -10,6 +10,7 @@ exports.registerFilePreExport = registerFilePreExport;
|
|
|
10
10
|
exports.registerFilePostExport = registerFilePostExport;
|
|
11
11
|
exports.registerFileTranslationsAlignmentExport = registerFileTranslationsAlignmentExport;
|
|
12
12
|
const crowdin_client_1 = __importDefault(require("../../middlewares/crowdin-client"));
|
|
13
|
+
const normalize_module_1 = require("../../util/normalize-module");
|
|
13
14
|
const custom_file_format_1 = __importDefault(require("./handlers/custom-file-format"));
|
|
14
15
|
const file_download_1 = __importDefault(require("./handlers/file-download"));
|
|
15
16
|
const pre_post_process_1 = __importDefault(require("./handlers/pre-post-process"));
|
|
@@ -17,97 +18,147 @@ const translations_alignment_1 = __importDefault(require("./handlers/translation
|
|
|
17
18
|
const types_1 = require("./types");
|
|
18
19
|
const defaults_1 = require("./util/defaults");
|
|
19
20
|
function registerCustomFileFormat({ config, app }) {
|
|
21
|
+
var _a;
|
|
20
22
|
if (!config.customFileFormat) {
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
(0,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.customFileFormat);
|
|
26
|
+
const isSingle = items.length === 1;
|
|
27
|
+
for (const [index, ff] of items.entries()) {
|
|
28
|
+
const key = (_a = ff.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'ff', item: ff, index, isSingle });
|
|
29
|
+
(0, defaults_1.applyFileProcessorsModuleDefaults)(config, ff);
|
|
30
|
+
const processUrl = isSingle ? '/file/process' : `/file/${key}/process`;
|
|
31
|
+
app.post(processUrl, (0, crowdin_client_1.default)({
|
|
32
|
+
config,
|
|
33
|
+
optional: false,
|
|
34
|
+
checkSubscriptionExpiration: true,
|
|
35
|
+
moduleKey: key,
|
|
36
|
+
}), (0, custom_file_format_1.default)({
|
|
37
|
+
baseUrl: config.baseUrl,
|
|
38
|
+
folder: ff.filesFolder || config.dbFolder,
|
|
39
|
+
config: ff,
|
|
40
|
+
fileStore: config.fileStore,
|
|
41
|
+
}));
|
|
42
|
+
app.get(isSingle ? '/file/download' : `/file/${key}/download`, (0, file_download_1.default)(config, ff, 'custom-file-format'));
|
|
43
|
+
}
|
|
44
|
+
if (isSingle) {
|
|
45
|
+
const ff = items[0];
|
|
46
|
+
// TEMPORARY CODE: it needs to support old path
|
|
47
|
+
app.post('/process', (0, crowdin_client_1.default)({
|
|
48
|
+
config,
|
|
49
|
+
optional: false,
|
|
50
|
+
checkSubscriptionExpiration: true,
|
|
51
|
+
}), (0, custom_file_format_1.default)({
|
|
52
|
+
baseUrl: config.baseUrl,
|
|
53
|
+
folder: ff.filesFolder || config.dbFolder,
|
|
54
|
+
config: ff,
|
|
55
|
+
fileStore: config.fileStore,
|
|
56
|
+
}));
|
|
57
|
+
// END TEMPORARY CODE
|
|
58
|
+
}
|
|
48
59
|
}
|
|
49
60
|
function registerFilePreImport({ config, app }) {
|
|
61
|
+
var _a;
|
|
50
62
|
if (!config.filePreImport) {
|
|
51
63
|
return;
|
|
52
64
|
}
|
|
53
|
-
(0,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePreImport);
|
|
66
|
+
const isSingle = items.length === 1;
|
|
67
|
+
for (const [index, item] of items.entries()) {
|
|
68
|
+
const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'pri', item, index, isSingle });
|
|
69
|
+
(0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
|
|
70
|
+
const processUrl = isSingle ? '/pre-import' : `/pre-import/${key}`;
|
|
71
|
+
app.post(processUrl, (0, crowdin_client_1.default)({
|
|
72
|
+
config,
|
|
73
|
+
optional: false,
|
|
74
|
+
checkSubscriptionExpiration: true,
|
|
75
|
+
moduleKey: key,
|
|
76
|
+
}), (0, pre_post_process_1.default)(config, item, types_1.ProcessFileJobType.PRE_IMPORT));
|
|
77
|
+
}
|
|
78
|
+
// Register download route once — shared across all instances
|
|
79
|
+
app.get(`/file/download/${types_1.ProcessFileJobType.PRE_IMPORT}`, (0, file_download_1.default)(config, items[0], types_1.ProcessFileJobType.PRE_IMPORT));
|
|
61
80
|
}
|
|
62
81
|
function registerFilePostImport({ config, app }) {
|
|
82
|
+
var _a;
|
|
63
83
|
if (!config.filePostImport) {
|
|
64
84
|
return;
|
|
65
85
|
}
|
|
66
|
-
(0,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePostImport);
|
|
87
|
+
const isSingle = items.length === 1;
|
|
88
|
+
for (const [index, item] of items.entries()) {
|
|
89
|
+
const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'poi', item, index, isSingle });
|
|
90
|
+
(0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
|
|
91
|
+
const processUrl = isSingle ? '/post-import' : `/post-import/${key}`;
|
|
92
|
+
app.post(processUrl, (0, crowdin_client_1.default)({
|
|
93
|
+
config,
|
|
94
|
+
optional: false,
|
|
95
|
+
checkSubscriptionExpiration: true,
|
|
96
|
+
moduleKey: key,
|
|
97
|
+
}), (0, pre_post_process_1.default)(config, item, types_1.ProcessFileJobType.POST_IMPORT));
|
|
98
|
+
}
|
|
99
|
+
// Register download route once — shared across all instances
|
|
100
|
+
app.get(`/file/download/${types_1.ProcessFileJobType.POST_IMPORT}`, (0, file_download_1.default)(config, items[0], types_1.ProcessFileJobType.POST_IMPORT));
|
|
74
101
|
}
|
|
75
102
|
function registerFilePreExport({ config, app }) {
|
|
103
|
+
var _a;
|
|
76
104
|
if (!config.filePreExport) {
|
|
77
105
|
return;
|
|
78
106
|
}
|
|
79
|
-
(0,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
107
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePreExport);
|
|
108
|
+
const isSingle = items.length === 1;
|
|
109
|
+
for (const [index, item] of items.entries()) {
|
|
110
|
+
const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'pre', item, index, isSingle });
|
|
111
|
+
(0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
|
|
112
|
+
const processUrl = isSingle ? '/pre-export' : `/pre-export/${key}`;
|
|
113
|
+
app.post(processUrl, (0, crowdin_client_1.default)({
|
|
114
|
+
config,
|
|
115
|
+
optional: false,
|
|
116
|
+
checkSubscriptionExpiration: true,
|
|
117
|
+
moduleKey: key,
|
|
118
|
+
}), (0, pre_post_process_1.default)(config, item, types_1.ProcessFileJobType.PRE_EXPORT));
|
|
119
|
+
}
|
|
120
|
+
// Register download route once — shared across all instances
|
|
121
|
+
app.get(`/file/download/${types_1.ProcessFileJobType.PRE_EXPORT}`, (0, file_download_1.default)(config, items[0], types_1.ProcessFileJobType.PRE_EXPORT));
|
|
87
122
|
}
|
|
88
123
|
function registerFilePostExport({ config, app }) {
|
|
124
|
+
var _a;
|
|
89
125
|
if (!config.filePostExport) {
|
|
90
126
|
return;
|
|
91
127
|
}
|
|
92
|
-
(0,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
128
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.filePostExport);
|
|
129
|
+
const isSingle = items.length === 1;
|
|
130
|
+
for (const [index, item] of items.entries()) {
|
|
131
|
+
const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'poe', item, index, isSingle });
|
|
132
|
+
(0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
|
|
133
|
+
const processUrl = isSingle ? '/post-export' : `/post-export/${key}`;
|
|
134
|
+
app.post(processUrl, (0, crowdin_client_1.default)({
|
|
135
|
+
config,
|
|
136
|
+
optional: false,
|
|
137
|
+
checkSubscriptionExpiration: true,
|
|
138
|
+
moduleKey: key,
|
|
139
|
+
}), (0, pre_post_process_1.default)(config, item, types_1.ProcessFileJobType.POST_EXPORT));
|
|
140
|
+
}
|
|
141
|
+
// Register download route once — shared across all instances
|
|
142
|
+
app.get(`/file/download/${types_1.ProcessFileJobType.POST_EXPORT}`, (0, file_download_1.default)(config, items[0], types_1.ProcessFileJobType.POST_EXPORT));
|
|
100
143
|
}
|
|
101
144
|
function registerFileTranslationsAlignmentExport({ config, app }) {
|
|
145
|
+
var _a;
|
|
102
146
|
if (!config.fileTranslationsAlignmentExport) {
|
|
103
147
|
return;
|
|
104
148
|
}
|
|
105
|
-
(0,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
149
|
+
const items = (0, normalize_module_1.normalizeToArray)(config.fileTranslationsAlignmentExport);
|
|
150
|
+
const isSingle = items.length === 1;
|
|
151
|
+
for (const [index, item] of items.entries()) {
|
|
152
|
+
const key = (_a = item.key) !== null && _a !== void 0 ? _a : (0, normalize_module_1.resolveInstanceKey)({ identifier: config.identifier, suffix: 'ftae', item, index, isSingle });
|
|
153
|
+
(0, defaults_1.applyFileProcessorsModuleDefaults)(config, item);
|
|
154
|
+
const processUrl = isSingle ? '/translations-alignment' : `/translations-alignment/${key}`;
|
|
155
|
+
app.post(processUrl, (0, crowdin_client_1.default)({
|
|
156
|
+
config,
|
|
157
|
+
optional: false,
|
|
158
|
+
checkSubscriptionExpiration: true,
|
|
159
|
+
moduleKey: key,
|
|
160
|
+
}), (0, translations_alignment_1.default)(config, item, types_1.ProcessFileJobType.TRANSLATIONS_ALIGNMENT));
|
|
161
|
+
}
|
|
162
|
+
// Register download route once — shared across all instances
|
|
163
|
+
app.get(`/file/download/${types_1.ProcessFileJobType.POST_EXPORT}`, (0, file_download_1.default)(config, items[0], types_1.ProcessFileJobType.TRANSLATIONS_ALIGNMENT));
|
|
113
164
|
}
|