@crowdin/app-project-module 0.58.1 → 0.58.3
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.
|
@@ -205,7 +205,7 @@ function filesCron({ config, integration, period, }) {
|
|
|
205
205
|
onlyApproved,
|
|
206
206
|
onlyTranslated,
|
|
207
207
|
});
|
|
208
|
-
if (Object.keys(filesToProcess).length
|
|
208
|
+
if (Object.keys(filesToProcess).length <= 0) {
|
|
209
209
|
continue;
|
|
210
210
|
}
|
|
211
211
|
(0, logger_1.log)(`Executing updateIntegration task for files cron job with period [${period}] for project ${projectId}.Files ${Object.keys(filesToProcess).length}`);
|
|
@@ -264,7 +264,7 @@ function filesCron({ config, integration, period, }) {
|
|
|
264
264
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
265
265
|
node_type: file.nodeType || file.node_type }, (file.type ? { type: file.type } : {}))));
|
|
266
266
|
const intFiles = allIntFiles.filter((file) => 'type' in file);
|
|
267
|
-
if (intFiles.length
|
|
267
|
+
if (intFiles.length <= 0) {
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
270
|
(0, logger_1.log)(`Executing updateCrowdin task for files cron job with period [${period}] for project ${projectId}. Files ${intFiles.length}`);
|
package/out/util/connection.js
CHANGED
|
@@ -289,7 +289,7 @@ function refreshCrowdinCreds({ config, credentials }) {
|
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
291
|
function refreshToken(config, credentials) {
|
|
292
|
-
var _a, _b;
|
|
292
|
+
var _a, _b, _c;
|
|
293
293
|
return __awaiter(this, void 0, void 0, function* () {
|
|
294
294
|
if (config.authenticationType === types_1.AuthenticationType.CODE) {
|
|
295
295
|
const token = yield (0, crowdin_apps_functions_1.refreshOAuthToken)({
|
|
@@ -304,6 +304,23 @@ function refreshToken(config, credentials) {
|
|
|
304
304
|
expiresIn: token.expiresIn,
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
+
if (config.authenticationType === types_1.AuthenticationType.AGENT) {
|
|
308
|
+
const token = yield (0, crowdin_apps_functions_1.fetchAgentToken)({
|
|
309
|
+
appId: config.identifier,
|
|
310
|
+
appSecret: credentials.appSecret,
|
|
311
|
+
clientId: config.clientId,
|
|
312
|
+
clientSecret: config.clientSecret,
|
|
313
|
+
domain: credentials.domain || '',
|
|
314
|
+
userId: credentials.userId,
|
|
315
|
+
agentId: credentials.agentId,
|
|
316
|
+
url: (_b = config.crowdinUrls) === null || _b === void 0 ? void 0 : _b.accountUrl,
|
|
317
|
+
});
|
|
318
|
+
return {
|
|
319
|
+
accessToken: (0, _1.encryptData)(config, token.accessToken),
|
|
320
|
+
expiresIn: token.expiresIn,
|
|
321
|
+
refreshToken: '',
|
|
322
|
+
};
|
|
323
|
+
}
|
|
307
324
|
const token = yield (0, crowdin_apps_functions_1.fetchAppToken)({
|
|
308
325
|
appId: config.identifier,
|
|
309
326
|
appSecret: credentials.appSecret,
|
|
@@ -311,7 +328,7 @@ function refreshToken(config, credentials) {
|
|
|
311
328
|
clientSecret: config.clientSecret,
|
|
312
329
|
domain: credentials.domain || '',
|
|
313
330
|
userId: credentials.userId,
|
|
314
|
-
url: (
|
|
331
|
+
url: (_c = config.crowdinUrls) === null || _c === void 0 ? void 0 : _c.accountUrl,
|
|
315
332
|
});
|
|
316
333
|
return {
|
|
317
334
|
accessToken: (0, _1.encryptData)(config, token.accessToken),
|
package/package.json
CHANGED