@crowdin/app-project-module 0.12.2 → 0.12.4
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/handlers/manifest.js +73 -0
- package/out/index.js +29 -2
- package/out/models/index.d.ts +24 -0
- package/out/util/index.js +5 -0
- package/package.json +1 -1
package/out/handlers/manifest.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
function handle(config) {
|
|
4
4
|
const modules = {};
|
|
5
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
5
6
|
if (config.integration) {
|
|
6
7
|
modules.integrations = [
|
|
7
8
|
{
|
|
@@ -13,6 +14,18 @@ function handle(config) {
|
|
|
13
14
|
},
|
|
14
15
|
];
|
|
15
16
|
}
|
|
17
|
+
// END OF TEMPORARY CODE
|
|
18
|
+
if (config.projectIntegration) {
|
|
19
|
+
modules['project-integrations'] = [
|
|
20
|
+
{
|
|
21
|
+
key: config.identifier + '-int',
|
|
22
|
+
name: config.name,
|
|
23
|
+
description: config.description,
|
|
24
|
+
logo: '/logo/integration/logo.png',
|
|
25
|
+
url: '/',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
16
29
|
if (config.customFileFormat) {
|
|
17
30
|
modules['custom-file-format'] = [
|
|
18
31
|
{
|
|
@@ -32,6 +45,7 @@ function handle(config) {
|
|
|
32
45
|
},
|
|
33
46
|
];
|
|
34
47
|
}
|
|
48
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
35
49
|
if (config.resources) {
|
|
36
50
|
modules['organization-menu'] = [
|
|
37
51
|
{
|
|
@@ -50,6 +64,28 @@ function handle(config) {
|
|
|
50
64
|
},
|
|
51
65
|
];
|
|
52
66
|
}
|
|
67
|
+
// END OF TEMPORARY CODE
|
|
68
|
+
if (config.organizationMenu) {
|
|
69
|
+
modules['organization-menu'] = [
|
|
70
|
+
{
|
|
71
|
+
key: config.identifier + '-resources',
|
|
72
|
+
name: config.name,
|
|
73
|
+
url: '/resources/' + (config.organizationMenu.fileName || 'index.html'),
|
|
74
|
+
icon: '/logo/resources/logo.png',
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
if (config.profileResourcesMenu) {
|
|
79
|
+
modules['profile-resources-menu'] = [
|
|
80
|
+
{
|
|
81
|
+
key: config.identifier + '-profile-resources-menu',
|
|
82
|
+
name: config.name,
|
|
83
|
+
url: '/resources/' + (config.profileResourcesMenu.fileName || 'index.html'),
|
|
84
|
+
icon: '/logo/resources/logo.png',
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
53
89
|
if (config.editorPanels) {
|
|
54
90
|
modules['editor-panels'] = [
|
|
55
91
|
{
|
|
@@ -61,6 +97,17 @@ function handle(config) {
|
|
|
61
97
|
},
|
|
62
98
|
];
|
|
63
99
|
}
|
|
100
|
+
// END OF TEMPORARY CODE
|
|
101
|
+
if (config.editorRightPanel) {
|
|
102
|
+
modules['editor-right-panel'] = [
|
|
103
|
+
{
|
|
104
|
+
key: config.identifier + '-editor-panels',
|
|
105
|
+
name: config.name,
|
|
106
|
+
url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'),
|
|
107
|
+
modes: config.editorRightPanel.modes,
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
}
|
|
64
111
|
if (config.projectMenu) {
|
|
65
112
|
modules['project-menu'] = [
|
|
66
113
|
{
|
|
@@ -70,6 +117,7 @@ function handle(config) {
|
|
|
70
117
|
},
|
|
71
118
|
];
|
|
72
119
|
}
|
|
120
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
73
121
|
if (config.tools) {
|
|
74
122
|
modules['tools'] = [
|
|
75
123
|
{
|
|
@@ -81,6 +129,19 @@ function handle(config) {
|
|
|
81
129
|
},
|
|
82
130
|
];
|
|
83
131
|
}
|
|
132
|
+
// END OF TEMPORARY CODE
|
|
133
|
+
if (config.projectTools) {
|
|
134
|
+
modules['project-tools'] = [
|
|
135
|
+
{
|
|
136
|
+
key: config.identifier + '-tools',
|
|
137
|
+
name: config.name,
|
|
138
|
+
description: config.description,
|
|
139
|
+
logo: '/logo/tools/logo.png',
|
|
140
|
+
url: '/tools/' + (config.projectTools.fileName || 'index.html'),
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
84
145
|
if (config.reports) {
|
|
85
146
|
modules['reports'] = [
|
|
86
147
|
{
|
|
@@ -92,6 +153,18 @@ function handle(config) {
|
|
|
92
153
|
},
|
|
93
154
|
];
|
|
94
155
|
}
|
|
156
|
+
// END OF TEMPORARY CODE
|
|
157
|
+
if (config.projectReports) {
|
|
158
|
+
modules['project-reports'] = [
|
|
159
|
+
{
|
|
160
|
+
key: config.identifier + '-project-reports',
|
|
161
|
+
name: config.name,
|
|
162
|
+
description: config.description,
|
|
163
|
+
logo: '/logo/reports/logo.png',
|
|
164
|
+
url: '/reports/' + (config.projectReports.fileName || 'index.html'),
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
}
|
|
95
168
|
return (_req, res) => {
|
|
96
169
|
const manifest = {
|
|
97
170
|
identifier: config.identifier,
|
package/out/index.js
CHANGED
|
@@ -88,7 +88,7 @@ function addCrowdinEndpoints(app, config) {
|
|
|
88
88
|
app.post('/installed', (0, install_1.default)(config));
|
|
89
89
|
app.post('/uninstall', (0, uninstall_1.default)(config));
|
|
90
90
|
app.get('/manifest.json', json_response_1.default, (0, manifest_1.default)(config));
|
|
91
|
-
const integrationLogic = config.integration;
|
|
91
|
+
const integrationLogic = config.integration || config.projectIntegration;
|
|
92
92
|
if (integrationLogic) {
|
|
93
93
|
(0, util_1.applyDefaults)(config, integrationLogic);
|
|
94
94
|
app.get('/logo/integration/logo.png', (req, res) => res.sendFile(integrationLogic.imagePath || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')));
|
|
@@ -127,24 +127,51 @@ function addCrowdinEndpoints(app, config) {
|
|
|
127
127
|
if (config.customMT) {
|
|
128
128
|
app.post('/translate', (0, crowdin_client_1.default)(config), (0, translate_1.default)(config, config.customMT));
|
|
129
129
|
}
|
|
130
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
130
131
|
if (config.resources) {
|
|
131
132
|
app.get('/logo/resources/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.resources) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
132
133
|
app.use('/resources', express_1.default.static(config.resources.uiPath));
|
|
133
134
|
}
|
|
135
|
+
// END OF TEMPORARY CODE
|
|
136
|
+
if (config.profileResourcesMenu) {
|
|
137
|
+
app.get('/logo/resources/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.profileResourcesMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
138
|
+
app.use('/resources', express_1.default.static(config.profileResourcesMenu.uiPath));
|
|
139
|
+
}
|
|
140
|
+
if (config.organizationMenu) {
|
|
141
|
+
app.get('/logo/resources/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.organizationMenu) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
142
|
+
app.use('/resources', express_1.default.static(config.organizationMenu.uiPath));
|
|
143
|
+
}
|
|
144
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
134
145
|
if (config.editorPanels) {
|
|
135
146
|
app.use('/editor-panels', express_1.default.static(config.editorPanels.uiPath));
|
|
136
147
|
}
|
|
148
|
+
// END OF TEMPORARY CODE
|
|
149
|
+
if (config.editorRightPanel) {
|
|
150
|
+
app.use('/editor-panels', express_1.default.static(config.editorRightPanel.uiPath));
|
|
151
|
+
}
|
|
137
152
|
if (config.projectMenu) {
|
|
138
153
|
app.use('/project-menu', express_1.default.static(config.projectMenu.uiPath));
|
|
139
154
|
}
|
|
155
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
140
156
|
if (config.tools) {
|
|
141
157
|
app.get('/logo/tools/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.tools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
142
158
|
app.use('/tools', express_1.default.static(config.tools.uiPath));
|
|
143
159
|
}
|
|
160
|
+
// END OF TEMPORARY CODE
|
|
161
|
+
if (config.projectTools) {
|
|
162
|
+
app.get('/logo/tools/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.projectTools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
163
|
+
app.use('/tools', express_1.default.static(config.projectTools.uiPath));
|
|
164
|
+
}
|
|
165
|
+
// TEMPORARY CODE drop on step 3 of CN-30453
|
|
144
166
|
if (config.reports) {
|
|
145
|
-
app.get('/logo/reports/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.
|
|
167
|
+
app.get('/logo/reports/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.reports) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
146
168
|
app.use('/reports', express_1.default.static(config.reports.uiPath));
|
|
147
169
|
}
|
|
170
|
+
// END OF TEMPORARY CODE
|
|
171
|
+
if (config.projectReports) {
|
|
172
|
+
app.get('/logo/reports/logo.png', (req, res) => { var _a; return res.sendFile(((_a = config.projectReports) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath || (0, path_1.join)(__dirname, 'logo.png')); });
|
|
173
|
+
app.use('/reports', express_1.default.static(config.projectReports.uiPath));
|
|
174
|
+
}
|
|
148
175
|
return {
|
|
149
176
|
getMetadata: storage.getMetadata,
|
|
150
177
|
saveMetadata: (id, metadata) => __awaiter(this, void 0, void 0, function* () {
|
package/out/models/index.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export interface Config extends ImagePath {
|
|
|
38
38
|
* integration module logic
|
|
39
39
|
*/
|
|
40
40
|
integration?: IntegrationLogic & ImagePath;
|
|
41
|
+
/**
|
|
42
|
+
* integration module logic
|
|
43
|
+
*/
|
|
44
|
+
projectIntegration?: IntegrationLogic & ImagePath;
|
|
41
45
|
/**
|
|
42
46
|
* custom file format module logic
|
|
43
47
|
*/
|
|
@@ -50,10 +54,22 @@ export interface Config extends ImagePath {
|
|
|
50
54
|
* resources module
|
|
51
55
|
*/
|
|
52
56
|
resources?: UiModule & ImagePath;
|
|
57
|
+
/**
|
|
58
|
+
* resources module
|
|
59
|
+
*/
|
|
60
|
+
profileResourcesMenu?: UiModule & ImagePath;
|
|
61
|
+
/**
|
|
62
|
+
* organization-menu module
|
|
63
|
+
*/
|
|
64
|
+
organizationMenu?: UiModule & ImagePath;
|
|
53
65
|
/**
|
|
54
66
|
* editor-panels module
|
|
55
67
|
*/
|
|
56
68
|
editorPanels?: EditorPanels;
|
|
69
|
+
/**
|
|
70
|
+
* editor-right-panel module
|
|
71
|
+
*/
|
|
72
|
+
editorRightPanel?: EditorPanels;
|
|
57
73
|
/**
|
|
58
74
|
* project menu module
|
|
59
75
|
*/
|
|
@@ -62,10 +78,18 @@ export interface Config extends ImagePath {
|
|
|
62
78
|
* tools module
|
|
63
79
|
*/
|
|
64
80
|
tools?: UiModule & ImagePath;
|
|
81
|
+
/**
|
|
82
|
+
* tools module
|
|
83
|
+
*/
|
|
84
|
+
projectTools?: UiModule & ImagePath;
|
|
65
85
|
/**
|
|
66
86
|
* reports module
|
|
67
87
|
*/
|
|
68
88
|
reports?: UiModule & ImagePath;
|
|
89
|
+
/**
|
|
90
|
+
* reports module
|
|
91
|
+
*/
|
|
92
|
+
projectReports?: UiModule & ImagePath;
|
|
69
93
|
/**
|
|
70
94
|
* Uninstall hook for cleanup logic
|
|
71
95
|
*/
|
package/out/util/index.js
CHANGED
|
@@ -203,6 +203,11 @@ function applyDefaults(config, integration) {
|
|
|
203
203
|
];
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
+
if (!integration.checkConnection) {
|
|
207
|
+
integration.checkConnection = (apiCredentials) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
yield integration.getIntegrationFiles(apiCredentials);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
206
211
|
}
|
|
207
212
|
exports.applyDefaults = applyDefaults;
|
|
208
213
|
function prepareCrowdinClient(config, credentials) {
|
package/package.json
CHANGED