@crowdin/app-project-module 0.58.0 → 0.58.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Environments, UiModule } from '../../types';
|
|
1
|
+
import { CrowdinContextInfo, Environments, UiModule } from '../../types';
|
|
2
2
|
import Crowdin, { SourceFilesModel, ProjectsGroupsModel, LanguagesModel, SourceStringsModel, StringTranslationsModel } from '@crowdin/crowdin-api-client';
|
|
3
3
|
export interface ExternalQaCheckModule extends Environments {
|
|
4
4
|
/**
|
|
@@ -13,7 +13,7 @@ export interface ExternalQaCheckModule extends Environments {
|
|
|
13
13
|
* jobs chunk size
|
|
14
14
|
*/
|
|
15
15
|
batchSize?: number;
|
|
16
|
-
validate: ({ client, file, project, sourceLanguage, strings, targetLanguage, translations, }: {
|
|
16
|
+
validate: ({ client, file, project, sourceLanguage, strings, targetLanguage, translations, context, }: {
|
|
17
17
|
client?: Crowdin;
|
|
18
18
|
file?: SourceFilesModel.File;
|
|
19
19
|
project?: ProjectsGroupsModel.Project;
|
|
@@ -21,6 +21,7 @@ export interface ExternalQaCheckModule extends Environments {
|
|
|
21
21
|
strings: SourceStringsModel.String[];
|
|
22
22
|
targetLanguage: LanguagesModel.Language;
|
|
23
23
|
translations: StringTranslationsModel.StringTranslation[];
|
|
24
|
+
context: CrowdinContextInfo;
|
|
24
25
|
}) => Promise<ExternalQaCheckResponse>;
|
|
25
26
|
/**
|
|
26
27
|
* Settings UI module
|
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