@crowdin/app-project-module 0.17.4 → 0.17.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/.github/workflows/basic.yml +39 -0
- package/.github/workflows/publish.yml +34 -0
- package/README.md +2 -1
- package/package.json +1 -1
- package/out/handlers/crowdin-file-progress.d.ts +0 -4
- package/out/handlers/crowdin-file-progress.js +0 -22
- package/out/handlers/crowdin-files.d.ts +0 -4
- package/out/handlers/crowdin-files.js +0 -31
- package/out/handlers/crowdin-project.d.ts +0 -4
- package/out/handlers/crowdin-project.js +0 -22
- package/out/handlers/crowdin-update.d.ts +0 -4
- package/out/handlers/crowdin-update.js +0 -26
- package/out/handlers/custom-file-format/download.d.ts +0 -4
- package/out/handlers/custom-file-format/download.js +0 -32
- package/out/handlers/custom-file-format/process.d.ts +0 -4
- package/out/handlers/custom-file-format/process.js +0 -134
- package/out/handlers/custom-mt/translate.d.ts +0 -4
- package/out/handlers/custom-mt/translate.js +0 -42
- package/out/handlers/install.d.ts +0 -4
- package/out/handlers/install.js +0 -45
- package/out/handlers/integration-data.d.ts +0 -4
- package/out/handlers/integration-data.js +0 -21
- package/out/handlers/integration-login.d.ts +0 -4
- package/out/handlers/integration-login.js +0 -30
- package/out/handlers/integration-logout.d.ts +0 -4
- package/out/handlers/integration-logout.js +0 -23
- package/out/handlers/integration-update.d.ts +0 -4
- package/out/handlers/integration-update.js +0 -25
- package/out/handlers/main.d.ts +0 -4
- package/out/handlers/main.js +0 -64
- package/out/handlers/manifest.d.ts +0 -3
- package/out/handlers/manifest.js +0 -126
- package/out/handlers/oauth-login.d.ts +0 -4
- package/out/handlers/oauth-login.js +0 -69
- package/out/handlers/settings-save.d.ts +0 -4
- package/out/handlers/settings-save.js +0 -21
- package/out/handlers/subscription-info.d.ts +0 -3
- package/out/handlers/subscription-info.js +0 -15
- package/out/handlers/subscription-paid.d.ts +0 -4
- package/out/handlers/subscription-paid.js +0 -22
- package/out/handlers/sync-settings-save.d.ts +0 -4
- package/out/handlers/sync-settings-save.js +0 -29
- package/out/handlers/sync-settings.d.ts +0 -4
- package/out/handlers/sync-settings.js +0 -27
- package/out/handlers/uninstall.d.ts +0 -4
- package/out/handlers/uninstall.js +0 -27
- package/out/index.d.ts +0 -5
- package/out/index.js +0 -191
- package/out/logo.png +0 -0
- package/out/middlewares/crowdin-client.d.ts +0 -10
- package/out/middlewares/crowdin-client.js +0 -88
- package/out/middlewares/integration-credentials.d.ts +0 -4
- package/out/middlewares/integration-credentials.js +0 -39
- package/out/middlewares/json-response.d.ts +0 -2
- package/out/middlewares/json-response.js +0 -7
- package/out/middlewares/ui-module.d.ts +0 -4
- package/out/middlewares/ui-module.js +0 -39
- package/out/models/index.d.ts +0 -538
- package/out/models/index.js +0 -41
- package/out/static/css/styles.css +0 -57
- package/out/static/js/main.js +0 -130
- package/out/static/js/polyfills/fetch.js +0 -494
- package/out/static/js/polyfills/promise.js +0 -375
- package/out/storage/index.d.ts +0 -22
- package/out/storage/index.js +0 -319
- package/out/util/connection.d.ts +0 -10
- package/out/util/connection.js +0 -213
- package/out/util/cron.d.ts +0 -3
- package/out/util/cron.js +0 -103
- package/out/util/defaults.d.ts +0 -5
- package/out/util/defaults.js +0 -153
- package/out/util/index.d.ts +0 -11
- package/out/util/index.js +0 -105
- package/out/views/install.handlebars +0 -16
- package/out/views/login.handlebars +0 -115
- package/out/views/main.handlebars +0 -471
- package/out/views/oauth.handlebars +0 -4
- package/out/views/partials/head.handlebars +0 -20
- package/out/views/subscription.handlebars +0 -26
package/out/storage/index.js
DELETED
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/camelcase */
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.getSyncSettings = exports.updateSyncSettings = exports.saveSyncSettings = exports.getAllSyncSettingsByType = exports.getSyncSettingsByProvider = exports.deleteMetadata = exports.getMetadata = exports.updateMetadata = exports.saveMetadata = exports.deleteIntegrationCredentials = exports.getAllIntegrationCredentials = exports.getIntegrationCredentials = exports.updateIntegrationConfig = exports.updateIntegrationCredentials = exports.saveIntegrationCredentials = exports.deleteCrowdinCredentials = exports.getAllCrowdinCredentials = exports.getCrowdinCredentials = exports.updateCrowdinCredentials = exports.saveCrowdinCredentials = exports.connect = void 0;
|
|
17
|
-
const path_1 = require("path");
|
|
18
|
-
const sqlite3_1 = __importDefault(require("sqlite3"));
|
|
19
|
-
let _res;
|
|
20
|
-
let _rej;
|
|
21
|
-
const dbPromise = new Promise((res, rej) => {
|
|
22
|
-
_res = res;
|
|
23
|
-
_rej = rej;
|
|
24
|
-
});
|
|
25
|
-
let db;
|
|
26
|
-
function _run(query, params) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
return new Promise((res, rej) => {
|
|
29
|
-
db.run(query, params, err => {
|
|
30
|
-
if (err) {
|
|
31
|
-
rej(err);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
res();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function run(query, params) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
yield dbPromise;
|
|
43
|
-
return new Promise((res, rej) => {
|
|
44
|
-
db.run(query, params, err => {
|
|
45
|
-
if (err) {
|
|
46
|
-
rej(err);
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
res();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function get(query, params) {
|
|
56
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
yield dbPromise;
|
|
58
|
-
return new Promise((res, rej) => {
|
|
59
|
-
db.get(query, params, (err, row) => {
|
|
60
|
-
if (err) {
|
|
61
|
-
rej(err);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
res(row);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
function each(query, params) {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
yield dbPromise;
|
|
73
|
-
return new Promise((res, rej) => {
|
|
74
|
-
const result = [];
|
|
75
|
-
db.each(query, params, (err, row) => {
|
|
76
|
-
if (err) {
|
|
77
|
-
rej(err);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
result.push(row);
|
|
81
|
-
}
|
|
82
|
-
}, () => res(result));
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function migrate() {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const newColumns = ['app_secret', 'domain', 'user_id', 'organization_id', 'base_url'];
|
|
89
|
-
const crowdinCredentialsInfo = yield each('PRAGMA table_info(crowdin_credentials);', []);
|
|
90
|
-
crowdinCredentialsInfo.map((columnInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
91
|
-
const index = newColumns.indexOf(columnInfo.name);
|
|
92
|
-
if (~index) {
|
|
93
|
-
newColumns.splice(index, 1);
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
96
|
-
for (const column of newColumns) {
|
|
97
|
-
yield run(`ALTER TABLE crowdin_credentials ADD COLUMN ${column} varchar null;`, []);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function connect(folder) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
let _connection_res;
|
|
104
|
-
let _connection_rej;
|
|
105
|
-
const connectionPromise = new Promise((res, rej) => {
|
|
106
|
-
_connection_res = res;
|
|
107
|
-
_connection_rej = rej;
|
|
108
|
-
});
|
|
109
|
-
db = new sqlite3_1.default.Database((0, path_1.join)(folder, 'app.sqlite'), error => {
|
|
110
|
-
if (error) {
|
|
111
|
-
_connection_rej(error);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
_connection_res();
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
try {
|
|
118
|
-
yield connectionPromise;
|
|
119
|
-
yield _run(`
|
|
120
|
-
create table if not exists crowdin_credentials
|
|
121
|
-
(
|
|
122
|
-
id varchar not null primary key,
|
|
123
|
-
app_secret varchar null,
|
|
124
|
-
domain varchar null,
|
|
125
|
-
user_id varchar null,
|
|
126
|
-
organization_id varchar null,
|
|
127
|
-
base_url varchar null,
|
|
128
|
-
access_token varchar not null,
|
|
129
|
-
refresh_token varchar not null,
|
|
130
|
-
expire varchar not null,
|
|
131
|
-
type varchar not null
|
|
132
|
-
);
|
|
133
|
-
`, []);
|
|
134
|
-
yield _run(`
|
|
135
|
-
create table if not exists integration_credentials
|
|
136
|
-
(
|
|
137
|
-
id varchar not null primary key,
|
|
138
|
-
credentials varchar not null,
|
|
139
|
-
config varchar null,
|
|
140
|
-
crowdin_id varchar not null
|
|
141
|
-
);
|
|
142
|
-
`, []);
|
|
143
|
-
yield _run(`
|
|
144
|
-
create table if not exists sync_settings
|
|
145
|
-
(
|
|
146
|
-
id integer not null primary key autoincrement,
|
|
147
|
-
files varchar null,
|
|
148
|
-
integration_id varchar not null,
|
|
149
|
-
crowdin_id varchar not null,
|
|
150
|
-
type varchar not null,
|
|
151
|
-
provider varchar not null
|
|
152
|
-
);
|
|
153
|
-
`, []);
|
|
154
|
-
yield _run(`
|
|
155
|
-
create table if not exists app_metadata
|
|
156
|
-
(
|
|
157
|
-
id varchar not null primary key,
|
|
158
|
-
data varchar null
|
|
159
|
-
);
|
|
160
|
-
`, []);
|
|
161
|
-
_res();
|
|
162
|
-
// TODO: temporary code
|
|
163
|
-
yield migrate();
|
|
164
|
-
}
|
|
165
|
-
catch (e) {
|
|
166
|
-
_rej(e);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
exports.connect = connect;
|
|
171
|
-
function saveCrowdinCredentials(credentials) {
|
|
172
|
-
return run('INSERT INTO crowdin_credentials(id, app_secret, domain, user_id, organization_id, base_url, access_token, refresh_token, expire, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [
|
|
173
|
-
credentials.id,
|
|
174
|
-
credentials.appSecret,
|
|
175
|
-
credentials.domain,
|
|
176
|
-
credentials.userId,
|
|
177
|
-
credentials.organizationId,
|
|
178
|
-
credentials.baseUrl,
|
|
179
|
-
credentials.accessToken,
|
|
180
|
-
credentials.refreshToken,
|
|
181
|
-
credentials.expire,
|
|
182
|
-
credentials.type,
|
|
183
|
-
]);
|
|
184
|
-
}
|
|
185
|
-
exports.saveCrowdinCredentials = saveCrowdinCredentials;
|
|
186
|
-
function updateCrowdinCredentials(credentials) {
|
|
187
|
-
return run('UPDATE crowdin_credentials SET app_secret = ?, domain = ?, user_id = ?, organization_id = ?, base_url = ?, access_token = ?, refresh_token = ?, expire = ? WHERE id = ?', [
|
|
188
|
-
credentials.appSecret,
|
|
189
|
-
credentials.domain,
|
|
190
|
-
credentials.userId,
|
|
191
|
-
credentials.organizationId,
|
|
192
|
-
credentials.baseUrl,
|
|
193
|
-
credentials.accessToken,
|
|
194
|
-
credentials.refreshToken,
|
|
195
|
-
credentials.expire,
|
|
196
|
-
credentials.id,
|
|
197
|
-
]);
|
|
198
|
-
}
|
|
199
|
-
exports.updateCrowdinCredentials = updateCrowdinCredentials;
|
|
200
|
-
function getCrowdinCredentials(id) {
|
|
201
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
-
const row = yield get('SELECT id, app_secret as appSecret, domain, user_id as userId, organization_id as organizationId, base_url as baseUrl, access_token as accessToken, refresh_token as refreshToken, expire, type FROM crowdin_credentials WHERE id = ?', [id]);
|
|
203
|
-
if (row) {
|
|
204
|
-
return row;
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
exports.getCrowdinCredentials = getCrowdinCredentials;
|
|
209
|
-
function getAllCrowdinCredentials() {
|
|
210
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
-
return each('SELECT id, app_secret as appSecret, domain, user_id as userId, organization_id as organizationId, base_url as baseUrl, access_token as accessToken, refresh_token as refreshToken, expire, type FROM crowdin_credentials', []);
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
exports.getAllCrowdinCredentials = getAllCrowdinCredentials;
|
|
215
|
-
function deleteCrowdinCredentials(id) {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
-
yield run('DELETE FROM crowdin_credentials where id = ?', [id]);
|
|
218
|
-
yield run('DELETE FROM integration_credentials where crowdin_id = ?', [id]);
|
|
219
|
-
yield run('DELETE FROM sync_settings WHERE crowdin_id = ?', [id]);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
exports.deleteCrowdinCredentials = deleteCrowdinCredentials;
|
|
223
|
-
function saveIntegrationCredentials(id, credentials, crowdinId) {
|
|
224
|
-
return run('INSERT INTO integration_credentials(id, credentials, crowdin_id) VALUES (?, ?, ?)', [
|
|
225
|
-
id,
|
|
226
|
-
credentials,
|
|
227
|
-
crowdinId,
|
|
228
|
-
]);
|
|
229
|
-
}
|
|
230
|
-
exports.saveIntegrationCredentials = saveIntegrationCredentials;
|
|
231
|
-
function updateIntegrationCredentials(id, credentials) {
|
|
232
|
-
return run('UPDATE integration_credentials SET credentials = ? WHERE id = ?', [credentials, id]);
|
|
233
|
-
}
|
|
234
|
-
exports.updateIntegrationCredentials = updateIntegrationCredentials;
|
|
235
|
-
function updateIntegrationConfig(id, config) {
|
|
236
|
-
return run('UPDATE integration_credentials SET config = ? WHERE id = ?', [config, id]);
|
|
237
|
-
}
|
|
238
|
-
exports.updateIntegrationConfig = updateIntegrationConfig;
|
|
239
|
-
function getIntegrationCredentials(id) {
|
|
240
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
const row = yield get('SELECT id, credentials, config, crowdin_id as crowdinId FROM integration_credentials WHERE id = ?', [id]);
|
|
242
|
-
if (row) {
|
|
243
|
-
return row;
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
exports.getIntegrationCredentials = getIntegrationCredentials;
|
|
248
|
-
function getAllIntegrationCredentials(crowdinId) {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
250
|
-
return each('SELECT id, credentials, config, crowdin_id as crowdinId FROM integration_credentials WHERE crowdin_id = ?', [crowdinId]);
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
exports.getAllIntegrationCredentials = getAllIntegrationCredentials;
|
|
254
|
-
function deleteIntegrationCredentials(id) {
|
|
255
|
-
return run('DELETE FROM integration_credentials where id = ?', [id]);
|
|
256
|
-
return run('DELETE FROM sync_settings where integration_id = ?', [id]);
|
|
257
|
-
}
|
|
258
|
-
exports.deleteIntegrationCredentials = deleteIntegrationCredentials;
|
|
259
|
-
function saveMetadata(id, metadata) {
|
|
260
|
-
return run('INSERT INTO app_metadata(id, data) VALUES (?, ?)', [id, JSON.stringify(metadata)]);
|
|
261
|
-
}
|
|
262
|
-
exports.saveMetadata = saveMetadata;
|
|
263
|
-
function updateMetadata(id, metadata) {
|
|
264
|
-
return run('UPDATE app_metadata SET data = ? WHERE id = ?', [JSON.stringify(metadata), id]);
|
|
265
|
-
}
|
|
266
|
-
exports.updateMetadata = updateMetadata;
|
|
267
|
-
function getMetadata(id) {
|
|
268
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
269
|
-
const row = yield get('SELECT data FROM app_metadata WHERE id = ?', [id]);
|
|
270
|
-
if (row) {
|
|
271
|
-
return JSON.parse(row.data);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
exports.getMetadata = getMetadata;
|
|
276
|
-
function deleteMetadata(id) {
|
|
277
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
-
yield run('DELETE FROM app_metadata where id = ?', [id]);
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
exports.deleteMetadata = deleteMetadata;
|
|
282
|
-
function getSyncSettingsByProvider(integrationId, provider) {
|
|
283
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
-
const row = yield get('SELECT id, files, integration_id as integrationId, crowdin_id as crowdinId, type, provider FROM sync_settings WHERE integration_id = ? AND provider = ?', [integrationId, provider]);
|
|
285
|
-
if (row) {
|
|
286
|
-
return row;
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
exports.getSyncSettingsByProvider = getSyncSettingsByProvider;
|
|
291
|
-
function getAllSyncSettingsByType(type) {
|
|
292
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
return each('SELECT id, files, integration_id as integrationId, crowdin_id as crowdinId, type, provider FROM sync_settings WHERE type = ?', [type]);
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
exports.getAllSyncSettingsByType = getAllSyncSettingsByType;
|
|
297
|
-
function saveSyncSettings(files, integrationId, crowdinId, type, provider) {
|
|
298
|
-
return run('INSERT INTO sync_settings(files, integration_id, crowdin_id, type, provider) VALUES (?, ?, ?, ?, ?)', [
|
|
299
|
-
files,
|
|
300
|
-
integrationId,
|
|
301
|
-
crowdinId,
|
|
302
|
-
type,
|
|
303
|
-
provider,
|
|
304
|
-
]);
|
|
305
|
-
}
|
|
306
|
-
exports.saveSyncSettings = saveSyncSettings;
|
|
307
|
-
function updateSyncSettings(files, integrationId, crowdinId, type, provider) {
|
|
308
|
-
return run('UPDATE sync_settings SET files = ? WHERE integration_id = ? AND crowdin_id = ? AND type = ? AND provider = ?', [files, integrationId, crowdinId, type, provider]);
|
|
309
|
-
}
|
|
310
|
-
exports.updateSyncSettings = updateSyncSettings;
|
|
311
|
-
function getSyncSettings(integrationId, crowdinId, type, provider) {
|
|
312
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
const row = yield get('SELECT id, files, integration_id as integrationId, crowdin_id as crowdinId, type FROM sync_settings WHERE integration_id = ? AND crowdin_id = ? AND type = ? AND provider = ?', [integrationId, crowdinId, type, provider]);
|
|
314
|
-
if (row) {
|
|
315
|
-
return row;
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
exports.getSyncSettings = getSyncSettings;
|
package/out/util/connection.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Crowdin from '@crowdin/crowdin-api-client';
|
|
2
|
-
import { AccountType, Config, CrowdinCredentials, IntegrationCredentials, IntegrationLogic, SubscriptionInfo } from '../models';
|
|
3
|
-
export declare function prepareCrowdinClient(config: Config, credentials: CrowdinCredentials): Promise<{
|
|
4
|
-
client: Crowdin;
|
|
5
|
-
token: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare function prepareIntegrationCredentials(config: Config, integration: IntegrationLogic, integrationCredentials: IntegrationCredentials): Promise<any>;
|
|
8
|
-
export declare function clearCache(organization: string): void;
|
|
9
|
-
export declare function isAppFree(config: Config): boolean;
|
|
10
|
-
export declare function checkSubscription(config: Config, token: string, organization: string, accountType: AccountType): Promise<SubscriptionInfo>;
|
package/out/util/connection.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
-
};
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
exports.checkSubscription = exports.isAppFree = exports.clearCache = exports.prepareIntegrationCredentials = exports.prepareCrowdinClient = void 0;
|
|
35
|
-
const crowdin_api_client_1 = __importDefault(require("@crowdin/crowdin-api-client"));
|
|
36
|
-
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
37
|
-
const axios_1 = __importDefault(require("axios"));
|
|
38
|
-
const _1 = require(".");
|
|
39
|
-
const models_1 = require("../models");
|
|
40
|
-
const storage_1 = require("../storage");
|
|
41
|
-
function prepareCrowdinClient(config, credentials) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const isExpired = +credentials.expire < +new Date().getTime() / 1000;
|
|
44
|
-
let client;
|
|
45
|
-
let token;
|
|
46
|
-
const organization = credentials.type === models_1.AccountType.ENTERPRISE ? credentials.id : undefined;
|
|
47
|
-
if (!isExpired) {
|
|
48
|
-
const token = (0, _1.decryptData)(config, credentials.accessToken);
|
|
49
|
-
return {
|
|
50
|
-
client: new crowdin_api_client_1.default({ token, organization }),
|
|
51
|
-
token,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
(0, _1.log)('Crowdin credentials have expired. Requesting a new credentials', config.logger);
|
|
55
|
-
const newCredentials = yield crowdinAppFunctions.refreshOAuthToken(config.clientId, config.clientSecret, (0, _1.decryptData)(config, credentials.refreshToken));
|
|
56
|
-
(0, _1.log)('Saving updated crowdin credentials in the database', config.logger);
|
|
57
|
-
yield (0, storage_1.updateCrowdinCredentials)({
|
|
58
|
-
id: credentials.id,
|
|
59
|
-
appSecret: credentials.appSecret,
|
|
60
|
-
domain: credentials.domain,
|
|
61
|
-
userId: credentials.userId,
|
|
62
|
-
organizationId: credentials.organizationId,
|
|
63
|
-
baseUrl: credentials.baseUrl,
|
|
64
|
-
refreshToken: (0, _1.encryptData)(config, newCredentials.refreshToken),
|
|
65
|
-
accessToken: (0, _1.encryptData)(config, newCredentials.accessToken),
|
|
66
|
-
expire: (new Date().getTime() / 1000 + newCredentials.expiresIn).toString(),
|
|
67
|
-
type: credentials.type,
|
|
68
|
-
});
|
|
69
|
-
return {
|
|
70
|
-
client: new crowdin_api_client_1.default({ token: newCredentials.accessToken, organization }),
|
|
71
|
-
token: newCredentials.accessToken,
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
exports.prepareCrowdinClient = prepareCrowdinClient;
|
|
76
|
-
function prepareIntegrationCredentials(config, integration, integrationCredentials) {
|
|
77
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const credentials = JSON.parse((0, _1.decryptData)(config, integrationCredentials.credentials));
|
|
80
|
-
if ((_a = integration.oauthLogin) === null || _a === void 0 ? void 0 : _a.refresh) {
|
|
81
|
-
(0, _1.log)('Checking if integration credentials need to be refreshed', config.logger);
|
|
82
|
-
const oauthLogin = integration.oauthLogin;
|
|
83
|
-
const { expireIn } = credentials;
|
|
84
|
-
//2 min as an extra buffer
|
|
85
|
-
const isExpired = expireIn - 120 < Date.now() / 1000;
|
|
86
|
-
if (isExpired) {
|
|
87
|
-
(0, _1.log)('Integration credentials have expired. Requesting a new credentials', config.logger);
|
|
88
|
-
let newCredentials;
|
|
89
|
-
if (oauthLogin.performRefreshTokenRequest) {
|
|
90
|
-
newCredentials = yield oauthLogin.performRefreshTokenRequest(credentials);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
const url = oauthLogin.refreshTokenUrl || oauthLogin.accessTokenUrl;
|
|
94
|
-
const request = {};
|
|
95
|
-
request[((_b = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _b === void 0 ? void 0 : _b.clientId) || 'client_id'] = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.clientId;
|
|
96
|
-
request[((_c = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _c === void 0 ? void 0 : _c.clientSecret) || 'client_secret'] = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.clientSecret;
|
|
97
|
-
request[((_d = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _d === void 0 ? void 0 : _d.refreshToken) || 'refresh_token'] = credentials.refreshToken;
|
|
98
|
-
if (oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.extraRefreshTokenParameters) {
|
|
99
|
-
Object.entries(oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.extraRefreshTokenParameters).forEach(([key, value]) => (request[key] = value));
|
|
100
|
-
}
|
|
101
|
-
newCredentials = (yield axios_1.default.post(url || '', request, {
|
|
102
|
-
headers: { Accept: 'application/json' },
|
|
103
|
-
})).data;
|
|
104
|
-
}
|
|
105
|
-
credentials.accessToken = newCredentials[((_e = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _e === void 0 ? void 0 : _e.accessToken) || 'access_token'];
|
|
106
|
-
credentials.expireIn =
|
|
107
|
-
Number(newCredentials[((_f = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _f === void 0 ? void 0 : _f.expiresIn) || 'expires_in']) + Date.now() / 1000;
|
|
108
|
-
if (newCredentials[((_g = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _g === void 0 ? void 0 : _g.refreshToken) || 'refresh_token']) {
|
|
109
|
-
credentials.refreshToken = newCredentials[((_h = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _h === void 0 ? void 0 : _h.refreshToken) || 'refresh_token'];
|
|
110
|
-
}
|
|
111
|
-
(0, _1.log)('Saving updated integration credentials in the database', config.logger);
|
|
112
|
-
yield (0, storage_1.updateIntegrationCredentials)(integrationCredentials.id, (0, _1.encryptData)(config, JSON.stringify(credentials)));
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return credentials;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
exports.prepareIntegrationCredentials = prepareIntegrationCredentials;
|
|
119
|
-
const subscriptionCache = {};
|
|
120
|
-
function addToCache(organization, appIdenfifier, validUntil, type, cachingSeconds, subscribeLink) {
|
|
121
|
-
if (!cachingSeconds) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
const orgCache = subscriptionCache[organization] || {};
|
|
125
|
-
const now = new Date();
|
|
126
|
-
now.setSeconds(now.getSeconds() + cachingSeconds);
|
|
127
|
-
orgCache[appIdenfifier] = {
|
|
128
|
-
cacheValidUntil: now,
|
|
129
|
-
validUntil,
|
|
130
|
-
subscribeLink,
|
|
131
|
-
type,
|
|
132
|
-
};
|
|
133
|
-
subscriptionCache[organization] = orgCache;
|
|
134
|
-
}
|
|
135
|
-
function getFromCache(organization, appIdenfifier) {
|
|
136
|
-
return (subscriptionCache[organization] || {})[appIdenfifier];
|
|
137
|
-
}
|
|
138
|
-
function clearCache(organization) {
|
|
139
|
-
delete subscriptionCache[organization];
|
|
140
|
-
}
|
|
141
|
-
exports.clearCache = clearCache;
|
|
142
|
-
function isAppFree(config) {
|
|
143
|
-
return !config.pricing || config.pricing.planType === 'free';
|
|
144
|
-
}
|
|
145
|
-
exports.isAppFree = isAppFree;
|
|
146
|
-
function validateSubscription(date) {
|
|
147
|
-
const expired = date.getTime() < Date.now();
|
|
148
|
-
const daysLeft = Math.round((date.getTime() - Date.now()) / (1000 * 60 * 60 * 24));
|
|
149
|
-
return { expired, daysLeft };
|
|
150
|
-
}
|
|
151
|
-
function checkSubscription(config, token, organization, accountType) {
|
|
152
|
-
var _a, _b, _c, _d, _e, _f;
|
|
153
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
if (isAppFree(config)) {
|
|
155
|
-
return { expired: false };
|
|
156
|
-
}
|
|
157
|
-
(0, _1.log)('Checking subscription plan', config.logger);
|
|
158
|
-
const appIdentifier = config.identifier;
|
|
159
|
-
const cacheEntry = getFromCache(organization, appIdentifier);
|
|
160
|
-
if (cacheEntry) {
|
|
161
|
-
const { cacheValidUntil, validUntil, subscribeLink, type } = cacheEntry;
|
|
162
|
-
if (cacheValidUntil.getTime() > Date.now()) {
|
|
163
|
-
(0, _1.log)(`Loaded data from cache. Subscription is valid until ${validUntil.toISOString()}`, config.logger);
|
|
164
|
-
const { expired, daysLeft } = validateSubscription(new Date(validUntil));
|
|
165
|
-
(0, _1.log)(`expired ${expired}`, config.logger);
|
|
166
|
-
return { expired, subscribeLink, daysLeft, type };
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
try {
|
|
170
|
-
const subscription = yield crowdinAppFunctions.getSubscription({
|
|
171
|
-
appIdentifier,
|
|
172
|
-
organization: accountType === models_1.AccountType.ENTERPRISE ? organization : undefined,
|
|
173
|
-
token,
|
|
174
|
-
});
|
|
175
|
-
(0, _1.log)(`Recieved subscription info. ${JSON.stringify(subscription)}`, config.logger);
|
|
176
|
-
const { expired, daysLeft } = validateSubscription(new Date(subscription.expires));
|
|
177
|
-
(0, _1.log)(`expired ${expired}`, config.logger);
|
|
178
|
-
addToCache(organization, appIdentifier, new Date(subscription.expires), models_1.SubscriptionInfoType.SUBSCRIPTION, (_a = config.pricing) === null || _a === void 0 ? void 0 : _a.cachingSeconds);
|
|
179
|
-
return { expired, daysLeft, type: models_1.SubscriptionInfoType.SUBSCRIPTION };
|
|
180
|
-
}
|
|
181
|
-
catch (e) {
|
|
182
|
-
if (e instanceof crowdinAppFunctions.PaymentRequiredError) {
|
|
183
|
-
const { initializedAt, subscribeLink } = e;
|
|
184
|
-
(0, _1.log)(`Recieved 402 payment error. initializedAt ${initializedAt}`, config.logger);
|
|
185
|
-
//default 2 weeks
|
|
186
|
-
const defaultSubscriptionPlan = 14;
|
|
187
|
-
let days;
|
|
188
|
-
if (accountType === models_1.AccountType.ENTERPRISE) {
|
|
189
|
-
days = ((_b = config.pricing) === null || _b === void 0 ? void 0 : _b.trialEnterprise) || ((_c = config.pricing) === null || _c === void 0 ? void 0 : _c.trial) || defaultSubscriptionPlan;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
days = ((_d = config.pricing) === null || _d === void 0 ? void 0 : _d.trialCrowdin) || ((_e = config.pricing) === null || _e === void 0 ? void 0 : _e.trial) || defaultSubscriptionPlan;
|
|
193
|
-
}
|
|
194
|
-
(0, _1.log)(`Subscriptino trial plan ${days} days`, config.logger);
|
|
195
|
-
const date = new Date(initializedAt);
|
|
196
|
-
date.setDate(date.getDate() + days);
|
|
197
|
-
const { expired, daysLeft } = validateSubscription(date);
|
|
198
|
-
(0, _1.log)(`expired ${expired}`, config.logger);
|
|
199
|
-
addToCache(organization, appIdentifier, new Date(date), models_1.SubscriptionInfoType.TRIAL, (_f = config.pricing) === null || _f === void 0 ? void 0 : _f.cachingSeconds, subscribeLink);
|
|
200
|
-
return { expired, subscribeLink, daysLeft, type: models_1.SubscriptionInfoType.TRIAL };
|
|
201
|
-
}
|
|
202
|
-
if (config.onError) {
|
|
203
|
-
config.onError(e);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
console.error(e);
|
|
207
|
-
}
|
|
208
|
-
(0, _1.log)('Recieved http error from subscription request. Returning expired=false', config.logger);
|
|
209
|
-
return { expired: false };
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
exports.checkSubscription = checkSubscription;
|
package/out/util/cron.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Config, CronJob, IntegrationLogic } from '../models';
|
|
2
|
-
export declare function runJob(config: Config, integration: IntegrationLogic, job: CronJob): Promise<void>;
|
|
3
|
-
export declare function filesCron(config: Config, integration: IntegrationLogic, period: string): Promise<void>;
|
package/out/util/cron.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.filesCron = exports.runJob = void 0;
|
|
32
|
-
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
33
|
-
const _1 = require(".");
|
|
34
|
-
const storage_1 = require("../storage");
|
|
35
|
-
const connection_1 = require("./connection");
|
|
36
|
-
const defaults_1 = require("./defaults");
|
|
37
|
-
function runJob(config, integration, job) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
(0, _1.log)(`Starting cron job with expression [${job.expression}]`, config.logger);
|
|
40
|
-
const crowdinCredentialsList = yield (0, storage_1.getAllCrowdinCredentials)();
|
|
41
|
-
yield Promise.all(crowdinCredentialsList.map((crowdinCredentials) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const { client: crowdinClient, token } = yield (0, connection_1.prepareCrowdinClient)(config, crowdinCredentials);
|
|
43
|
-
const { expired } = yield (0, connection_1.checkSubscription)(config, token, crowdinCredentials.id, crowdinCredentials.type);
|
|
44
|
-
if (expired) {
|
|
45
|
-
(0, _1.log)(`Subscription expired. Skipping job [${job.expression}] for organization ${crowdinCredentials.id}`);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const integrationCredentialsList = yield (0, storage_1.getAllIntegrationCredentials)(crowdinCredentials.id);
|
|
49
|
-
yield Promise.all(integrationCredentialsList.map((integrationCredentials) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const projectId = crowdinAppFunctions.getProjectId(integrationCredentials.id);
|
|
51
|
-
const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
|
|
52
|
-
const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, crowdinClient, projectId);
|
|
53
|
-
const intConfig = integrationCredentials.config
|
|
54
|
-
? JSON.parse(integrationCredentials.config)
|
|
55
|
-
: undefined;
|
|
56
|
-
(0, _1.log)(`Executing task for cron job with expression [${job.expression}] for project ${projectId}`, config.logger);
|
|
57
|
-
yield job.task(projectId, crowdinClient, apiCredentials, rootFolder, intConfig);
|
|
58
|
-
(0, _1.log)(`Task for cron job with expression [${job.expression}] for project ${projectId} completed`, config.logger);
|
|
59
|
-
})));
|
|
60
|
-
})));
|
|
61
|
-
(0, _1.log)(`Cron job with expression [${job.expression}] completed`, config.logger);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
exports.runJob = runJob;
|
|
65
|
-
function filesCron(config, integration, period) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
(0, _1.log)(`Starting files cron job with period [${period}]`, config.logger);
|
|
68
|
-
const syncSettingsList = yield (0, storage_1.getAllSyncSettingsByType)('schedule');
|
|
69
|
-
yield Promise.all(syncSettingsList.map((syncSettings) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const files = JSON.parse(syncSettings.files);
|
|
71
|
-
const crowdinCredentials = yield (0, storage_1.getCrowdinCredentials)(syncSettings.crowdinId);
|
|
72
|
-
const integrationCredentials = yield (0, storage_1.getIntegrationCredentials)(syncSettings.integrationId);
|
|
73
|
-
if (crowdinCredentials && integrationCredentials) {
|
|
74
|
-
const intConfig = integrationCredentials.config
|
|
75
|
-
? JSON.parse(integrationCredentials.config)
|
|
76
|
-
: { schedule: '0' };
|
|
77
|
-
if (period === intConfig.schedule) {
|
|
78
|
-
const projectId = crowdinAppFunctions.getProjectId(integrationCredentials.id);
|
|
79
|
-
const { client: crowdinClient, token } = yield (0, connection_1.prepareCrowdinClient)(config, crowdinCredentials);
|
|
80
|
-
const { expired } = yield (0, connection_1.checkSubscription)(config, token, crowdinCredentials.id, crowdinCredentials.type);
|
|
81
|
-
if (expired) {
|
|
82
|
-
(0, _1.log)(`Subscription expired. Skipping job [${period}] for organization ${crowdinCredentials.id}`);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
|
|
86
|
-
const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, crowdinClient, projectId);
|
|
87
|
-
if (syncSettings.provider === 'crowdin') {
|
|
88
|
-
(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);
|
|
89
|
-
yield integration.updateIntegration(projectId, crowdinClient, apiCredentials, files, rootFolder, intConfig);
|
|
90
|
-
(0, _1.log)(`updateIntegration task for files cron job with period [${period}] for project ${projectId} completed`, config.logger);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
(0, _1.log)(`Executing updateCrowdin task for files cron job with period [${period}] for project ${projectId} and request ${JSON.stringify(files, null, 2)}`, config.logger);
|
|
94
|
-
yield integration.updateCrowdin(projectId, crowdinClient, apiCredentials, files, rootFolder, intConfig);
|
|
95
|
-
(0, _1.log)(`updateCrowdin task for files cron job with period [${period}] for project ${projectId} completed`, config.logger);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
})));
|
|
100
|
-
(0, _1.log)(`Files cron job with period [${period}] completed`, config.logger);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
exports.filesCron = filesCron;
|
package/out/util/defaults.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import Crowdin, { SourceFilesModel } from '@crowdin/crowdin-api-client';
|
|
2
|
-
import { Config, IntegrationLogic } from '../models';
|
|
3
|
-
export declare function getRootFolder(config: Config, integration: IntegrationLogic, client: Crowdin, projectId: number): Promise<SourceFilesModel.Directory | undefined>;
|
|
4
|
-
export declare function getOauthRoute(integration: IntegrationLogic): string;
|
|
5
|
-
export declare function applyDefaults(config: Config, integration: IntegrationLogic): void;
|