@crowdin/app-project-module 0.36.0 → 0.37.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/middlewares/crowdin-client.js +1 -1
- package/out/middlewares/ui-module.js +4 -3
- package/out/static/js/form.js +6 -6
- package/out/static/js/main.js +0 -1
- package/out/util/connection.d.ts +3 -2
- package/out/util/connection.js +7 -1
- package/out/util/cron.js +27 -2
- package/out/util/logger.d.ts +15 -0
- package/out/util/logger.js +53 -8
- package/out/util/webhooks.js +18 -2
- package/package.json +2 -2
|
@@ -36,7 +36,7 @@ function prepareCrowdinRequest(jwtToken, config, optional = false, checkSubscrip
|
|
|
36
36
|
throw new Error("Can't find organization by id");
|
|
37
37
|
}
|
|
38
38
|
logInfo('Building crowdin client instance');
|
|
39
|
-
const { client, token } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials, autoRenew: true });
|
|
39
|
+
const { client, token } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials, autoRenew: true, context });
|
|
40
40
|
let subscriptionInfo;
|
|
41
41
|
if (checkSubscriptionExpiration) {
|
|
42
42
|
subscriptionInfo = yield (0, connection_1.checkSubscription)({
|
|
@@ -27,18 +27,19 @@ function handle(config, allowUnauthorized = false) {
|
|
|
27
27
|
(0, logger_1.log)('Validating jwt token from incoming request');
|
|
28
28
|
const jwtPayload = yield (0, crowdin_apps_functions_1.validateJwtToken)(jwtToken, config.clientSecret, config.jwtValidationOptions);
|
|
29
29
|
const id = `${jwtPayload.domain || jwtPayload.context.organization_id}`;
|
|
30
|
-
const
|
|
30
|
+
const context = {
|
|
31
31
|
jwtPayload,
|
|
32
32
|
clientId: (0, crowdin_apps_functions_1.constructCrowdinIdFromJwtPayload)(jwtPayload),
|
|
33
33
|
crowdinId: id,
|
|
34
|
-
}
|
|
34
|
+
};
|
|
35
|
+
const logInfo = (0, logger_1.withContext)(context);
|
|
35
36
|
logInfo('Loading crowdin credentials');
|
|
36
37
|
const credentials = yield (0, storage_1.getStorage)().getCrowdinCredentials(id);
|
|
37
38
|
if (!credentials) {
|
|
38
39
|
throw new Error("Can't find organization by id");
|
|
39
40
|
}
|
|
40
41
|
logInfo('Building crowdin client instance');
|
|
41
|
-
const { token } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials });
|
|
42
|
+
const { token } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials, context });
|
|
42
43
|
const { expired, subscribeLink } = yield (0, connection_1.checkSubscription)({
|
|
43
44
|
config,
|
|
44
45
|
token,
|