@crowdin/app-project-module 0.23.4 → 0.23.6
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/custom-mt/translate.js +1 -1
- package/out/handlers/integration-login.js +1 -1
- package/out/handlers/integration-logout.js +1 -1
- package/out/handlers/integration-update.js +2 -2
- package/out/handlers/oauth-login.js +1 -1
- package/out/handlers/oauth-url.js +1 -1
- package/out/handlers/subscription-paid.js +1 -1
- package/out/handlers/uninstall.js +1 -1
- package/out/util/connection.js +4 -4
- package/out/util/cron.js +1 -1
- package/out/views/login.handlebars +2 -2
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ function handle(baseConfig, config) {
|
|
|
15
15
|
const source = req.query.source;
|
|
16
16
|
const target = req.query.target;
|
|
17
17
|
const body = req.body;
|
|
18
|
-
(0, util_1.log)('
|
|
18
|
+
(0, util_1.log)('Received request for custom mt', baseConfig.logger);
|
|
19
19
|
(0, util_1.log)(`Source language ${source}, target language ${target}`, baseConfig.logger);
|
|
20
20
|
(0, util_1.log)(`Payload ${JSON.stringify(body, null, 2)}`, baseConfig.logger);
|
|
21
21
|
const projectId = Number(req.query.project_id);
|
|
@@ -13,7 +13,7 @@ const storage_1 = require("../storage");
|
|
|
13
13
|
const util_1 = require("../util");
|
|
14
14
|
function handle(config, integration) {
|
|
15
15
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
(0, util_1.log)('
|
|
16
|
+
(0, util_1.log)('Received integration login request', config.logger);
|
|
17
17
|
if (integration.checkConnection) {
|
|
18
18
|
(0, util_1.log)('Checking the integration credentials', config.logger);
|
|
19
19
|
yield integration.checkConnection(req.body.credentials);
|
|
@@ -14,7 +14,7 @@ const util_1 = require("../util");
|
|
|
14
14
|
const connection_1 = require("../util/connection");
|
|
15
15
|
function handle(config, integration) {
|
|
16
16
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
(0, util_1.log)('
|
|
17
|
+
(0, util_1.log)('Received integration logout request', config.logger);
|
|
18
18
|
if (integration.onLogout) {
|
|
19
19
|
(0, util_1.log)('Invoking onLogout hook', config.logger);
|
|
20
20
|
yield integration.onLogout(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, req.integrationCredentials, req.integrationSettings);
|
|
@@ -13,10 +13,10 @@ const util_1 = require("../util");
|
|
|
13
13
|
const defaults_1 = require("../util/defaults");
|
|
14
14
|
function handle(config, integration) {
|
|
15
15
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
(0, util_1.log)('
|
|
16
|
+
(0, util_1.log)('Updating integration data', config.logger);
|
|
17
17
|
const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, req.crowdinApiClient, req.crowdinContext.jwtPayload.context.project_id);
|
|
18
18
|
if (rootFolder) {
|
|
19
|
-
(0, util_1.log)(`
|
|
19
|
+
(0, util_1.log)(`Updating integration data for crowding root folder ${rootFolder.id}`, config.logger);
|
|
20
20
|
}
|
|
21
21
|
const result = yield integration.updateIntegration(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, req.integrationCredentials, req.body, rootFolder, req.integrationSettings);
|
|
22
22
|
let message;
|
|
@@ -22,7 +22,7 @@ function handle(config, integration) {
|
|
|
22
22
|
uid: 'oauth_popup',
|
|
23
23
|
};
|
|
24
24
|
const code = req.query[((_b = (_a = integration.oauthLogin) === null || _a === void 0 ? void 0 : _a.fieldsMapping) === null || _b === void 0 ? void 0 : _b.code) || 'code'];
|
|
25
|
-
(0, util_1.log)(`
|
|
25
|
+
(0, util_1.log)(`Received request from OAuth login callback. Code ${code}`, config.logger);
|
|
26
26
|
try {
|
|
27
27
|
const oauthLogin = integration.oauthLogin;
|
|
28
28
|
let credentials;
|
|
@@ -13,7 +13,7 @@ const util_1 = require("../util");
|
|
|
13
13
|
const defaults_1 = require("../util/defaults");
|
|
14
14
|
function handle(config, integration) {
|
|
15
15
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
(0, util_1.log)('
|
|
16
|
+
(0, util_1.log)('Received OAuth login url request', config.logger);
|
|
17
17
|
const { oauthLogin } = integration;
|
|
18
18
|
if (!oauthLogin) {
|
|
19
19
|
(0, util_1.log)('OAuth login url request is not supported', config.logger);
|
|
@@ -14,7 +14,7 @@ const connection_1 = require("../util/connection");
|
|
|
14
14
|
function handle(config) {
|
|
15
15
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const organizationId = (req.query || {})['organization_id'] || (req.body || {})['organization_id'];
|
|
17
|
-
(0, util_1.log)(`
|
|
17
|
+
(0, util_1.log)(`Received subscription paid request for organization ${organizationId}`, config.logger);
|
|
18
18
|
(0, connection_1.clearCache)(organizationId);
|
|
19
19
|
res.status(204).end();
|
|
20
20
|
}), config.onError);
|
|
@@ -15,7 +15,7 @@ const connection_1 = require("../util/connection");
|
|
|
15
15
|
function handle(config) {
|
|
16
16
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const event = req.body;
|
|
18
|
-
(0, util_1.log)(`
|
|
18
|
+
(0, util_1.log)(`Received uninstall request ${JSON.stringify(event, null, 2)}`, config.logger);
|
|
19
19
|
const projectIntegration = config.projectIntegration;
|
|
20
20
|
const organization = (event.domain || event.organizationId).toString();
|
|
21
21
|
if (config.onUninstall) {
|
package/out/util/connection.js
CHANGED
|
@@ -117,14 +117,14 @@ function prepareIntegrationCredentials(config, integration, integrationCredentia
|
|
|
117
117
|
}
|
|
118
118
|
exports.prepareIntegrationCredentials = prepareIntegrationCredentials;
|
|
119
119
|
const subscriptionCache = {};
|
|
120
|
-
function addToCache(organization,
|
|
120
|
+
function addToCache(organization, appIdentifier, validUntil, type, cachingSeconds, subscribeLink) {
|
|
121
121
|
if (!cachingSeconds) {
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
const orgCache = subscriptionCache[organization] || {};
|
|
125
125
|
const now = new Date();
|
|
126
126
|
now.setSeconds(now.getSeconds() + cachingSeconds);
|
|
127
|
-
orgCache[
|
|
127
|
+
orgCache[appIdentifier] = {
|
|
128
128
|
cacheValidUntil: now,
|
|
129
129
|
validUntil,
|
|
130
130
|
subscribeLink,
|
|
@@ -132,8 +132,8 @@ function addToCache(organization, appIdenfifier, validUntil, type, cachingSecond
|
|
|
132
132
|
};
|
|
133
133
|
subscriptionCache[organization] = orgCache;
|
|
134
134
|
}
|
|
135
|
-
function getFromCache(organization,
|
|
136
|
-
return (subscriptionCache[organization] || {})[
|
|
135
|
+
function getFromCache(organization, appIdentifier) {
|
|
136
|
+
return (subscriptionCache[organization] || {})[appIdentifier];
|
|
137
137
|
}
|
|
138
138
|
function clearCache(organization) {
|
|
139
139
|
delete subscriptionCache[organization];
|
package/out/util/cron.js
CHANGED
|
@@ -98,7 +98,7 @@ function filesCron(config, integration, period) {
|
|
|
98
98
|
const crowdinFiles = files;
|
|
99
99
|
const onlyTranslated = intConfig.condition === SyncCondition.TRANSLATED;
|
|
100
100
|
const onlyApproved = intConfig.condition === SyncCondition.APPROVED;
|
|
101
|
-
const all = intConfig.condition === SyncCondition.ALL;
|
|
101
|
+
const all = intConfig.condition === SyncCondition.ALL || intConfig.condition === undefined;
|
|
102
102
|
(0, _1.log)(`Executing updateIntegration task for files cron job with period [${period}] for project ${projectId} and request ${JSON.stringify(files, null, 2)}`, config.logger);
|
|
103
103
|
if (all) {
|
|
104
104
|
yield integration.updateIntegration(projectId, crowdinClient, apiCredentials, crowdinFiles, rootFolder, intConfig);
|
|
@@ -143,10 +143,10 @@
|
|
|
143
143
|
)
|
|
144
144
|
.then(checkResponse)
|
|
145
145
|
.then(reloadLocation)
|
|
146
|
-
.catch(e =>
|
|
147
|
-
.finally(() => {
|
|
146
|
+
.catch(e => {
|
|
148
147
|
loginButton.setAttribute('disabled', false);
|
|
149
148
|
loginButton.setAttribute('is-loading', false);
|
|
149
|
+
catchRejection(e, 'Credentials are not stored');
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
152
|
|
package/package.json
CHANGED