@crowdin/app-project-module 0.78.0 → 0.78.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.
- package/out/storage/mysql.js +8 -8
- package/out/storage/postgre.js +10 -10
- package/out/util/logger.d.ts +2 -1
- package/out/util/logger.js +14 -7
- package/package.json +1 -1
package/out/storage/mysql.js
CHANGED
|
@@ -572,8 +572,8 @@ class MySQLStorage {
|
|
|
572
572
|
yield this.dbPromise;
|
|
573
573
|
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
574
574
|
const [rows] = yield connection.execute(`
|
|
575
|
-
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
576
|
-
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
575
|
+
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
576
|
+
title, info, data, attempt, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
577
577
|
FROM job
|
|
578
578
|
WHERE id = ?
|
|
579
579
|
`, [id]);
|
|
@@ -586,8 +586,8 @@ class MySQLStorage {
|
|
|
586
586
|
yield this.dbPromise;
|
|
587
587
|
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
588
588
|
const [rows] = yield connection.execute(`
|
|
589
|
-
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
590
|
-
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
589
|
+
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
590
|
+
title, info, data, attempt, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
591
591
|
FROM job
|
|
592
592
|
WHERE integration_id = ? AND crowdin_id = ? AND finished_at is NULL
|
|
593
593
|
`, [integrationId, crowdinId]);
|
|
@@ -606,8 +606,8 @@ class MySQLStorage {
|
|
|
606
606
|
yield this.dbPromise;
|
|
607
607
|
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
608
608
|
const [rows] = yield connection.execute(`
|
|
609
|
-
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
610
|
-
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
609
|
+
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
610
|
+
title, info, data, attempt, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
611
611
|
FROM job
|
|
612
612
|
WHERE status IN (?, ?) AND finished_at is NULL
|
|
613
613
|
`, [types_1.JobStatus.IN_PROGRESS, types_1.JobStatus.CREATED]);
|
|
@@ -629,7 +629,7 @@ class MySQLStorage {
|
|
|
629
629
|
yield this.dbPromise;
|
|
630
630
|
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
631
631
|
const [rows] = yield connection.execute(`
|
|
632
|
-
SELECT integration_id as integrationId, crowdin_id as crowdinId, file_id as fileId, language_id as languageId, etag
|
|
632
|
+
SELECT integration_id as "integrationId", crowdin_id as "crowdinId", file_id as "fileId", language_id as "languageId", etag
|
|
633
633
|
FROM translation_file_cache
|
|
634
634
|
WHERE integration_id = ? AND crowdin_id = ? AND file_id = ?
|
|
635
635
|
`, [integrationId, crowdinId, fileId]);
|
|
@@ -642,7 +642,7 @@ class MySQLStorage {
|
|
|
642
642
|
yield this.dbPromise;
|
|
643
643
|
return this.executeQuery((connection) => __awaiter(this, void 0, void 0, function* () {
|
|
644
644
|
const [rows] = yield connection.execute(`
|
|
645
|
-
SELECT integration_id as integrationId, crowdin_id as
|
|
645
|
+
SELECT integration_id as "integrationId", crowdin_id as "crowdinId", file_id as "fileId", language_id as "languageId", etag
|
|
646
646
|
FROM translation_file_cache
|
|
647
647
|
WHERE integration_id = ? AND crowdin_id = ? AND file_id = ? AND language_id = ?
|
|
648
648
|
`, [integrationId, crowdinId, fileId, languageId]);
|
package/out/storage/postgre.js
CHANGED
|
@@ -474,7 +474,7 @@ class PostgreStorage {
|
|
|
474
474
|
let index = 0;
|
|
475
475
|
const placeholders = fileIds.map(() => `$${++index}`).join(',');
|
|
476
476
|
yield this.dbPromise;
|
|
477
|
-
yield this.executeQuery((client) => client.query(`DELETE FROM webhooks WHERE file_id IN ${placeholders} AND integration_id = $${++index} AND crowdin_id = $${++index} AND provider = $${++index}`, [...fileIds, integrationId, crowdinId, provider]));
|
|
477
|
+
yield this.executeQuery((client) => client.query(`DELETE FROM webhooks WHERE file_id IN (${placeholders}) AND integration_id = $${++index} AND crowdin_id = $${++index} AND provider = $${++index}`, [...fileIds, integrationId, crowdinId, provider]));
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
getAllUserErrors(crowdinId, integrationId) {
|
|
@@ -624,8 +624,8 @@ class PostgreStorage {
|
|
|
624
624
|
yield this.dbPromise;
|
|
625
625
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
626
626
|
const res = yield client.query(`
|
|
627
|
-
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
628
|
-
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
627
|
+
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
628
|
+
title, info, data, attempt, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
629
629
|
FROM job
|
|
630
630
|
WHERE id = $1
|
|
631
631
|
`, [id]);
|
|
@@ -638,8 +638,8 @@ class PostgreStorage {
|
|
|
638
638
|
yield this.dbPromise;
|
|
639
639
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
640
640
|
const res = yield client.query(`
|
|
641
|
-
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
642
|
-
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
641
|
+
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
642
|
+
title, info, data, attempt, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
643
643
|
FROM job
|
|
644
644
|
WHERE integration_id = $1 AND crowdin_id = $2 AND finished_at is NULL
|
|
645
645
|
`, [integrationId, crowdinId]);
|
|
@@ -658,8 +658,8 @@ class PostgreStorage {
|
|
|
658
658
|
yield this.dbPromise;
|
|
659
659
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
660
660
|
const res = yield client.query(`
|
|
661
|
-
SELECT id, integration_id as integrationId, crowdin_id as crowdinId, type, payload, progress, status,
|
|
662
|
-
title, info, data, attempt, created_at as createdAt, updated_at as updatedAt, finished_at as finishedAt
|
|
661
|
+
SELECT id, integration_id as "integrationId", crowdin_id as "crowdinId", type, payload, progress, status,
|
|
662
|
+
title, info, data, attempt, created_at as "createdAt", updated_at as "updatedAt", finished_at as "finishedAt"
|
|
663
663
|
FROM job
|
|
664
664
|
WHERE status IN ($1, $2) AND finished_at is NULL
|
|
665
665
|
`, [types_2.JobStatus.IN_PROGRESS, types_2.JobStatus.CREATED]);
|
|
@@ -673,7 +673,7 @@ class PostgreStorage {
|
|
|
673
673
|
yield this.executeQuery((client) => client.query(`
|
|
674
674
|
INSERT
|
|
675
675
|
INTO translation_file_cache(integration_id, crowdin_id, file_id, language_id, etag)
|
|
676
|
-
VALUES ($1, $2, $3, $4, $
|
|
676
|
+
VALUES ($1, $2, $3, $4, $5)
|
|
677
677
|
`, [integrationId, crowdinId, fileId, languageId, etag]));
|
|
678
678
|
});
|
|
679
679
|
}
|
|
@@ -682,7 +682,7 @@ class PostgreStorage {
|
|
|
682
682
|
yield this.dbPromise;
|
|
683
683
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
684
684
|
const res = yield client.query(`
|
|
685
|
-
SELECT integration_id as integrationId, crowdin_id as crowdinId, file_id as fileId, language_id as languageId, etag
|
|
685
|
+
SELECT integration_id as "integrationId", crowdin_id as "crowdinId", file_id as "fileId", language_id as "languageId", etag
|
|
686
686
|
FROM translation_file_cache
|
|
687
687
|
WHERE integration_id = $1 AND crowdin_id = $2 AND file_id = $3
|
|
688
688
|
`, [integrationId, crowdinId, fileId]);
|
|
@@ -695,7 +695,7 @@ class PostgreStorage {
|
|
|
695
695
|
yield this.dbPromise;
|
|
696
696
|
return this.executeQuery((client) => __awaiter(this, void 0, void 0, function* () {
|
|
697
697
|
const res = yield client.query(`
|
|
698
|
-
SELECT integration_id as integrationId, crowdin_id as crowdinId, file_id as fileId, language_id as languageId
|
|
698
|
+
SELECT integration_id as "integrationId", crowdin_id as "crowdinId", file_id as "fileId", language_id as "languageId", etag
|
|
699
699
|
FROM translation_file_cache
|
|
700
700
|
WHERE integration_id = $1 AND crowdin_id = $2 AND file_id = $3 AND language_id = $4
|
|
701
701
|
`, [integrationId, crowdinId, fileId, languageId]);
|
package/out/util/logger.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare function withContextError(context: CrowdinContextInfo): LogFuncti
|
|
|
16
16
|
export declare function log(message: string, context?: CrowdinContextInfo): void;
|
|
17
17
|
export declare function logError(e: any, context?: CrowdinContextInfo): void;
|
|
18
18
|
export declare function isAxiosError(e: any): e is CustomAxiosError;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function isInternalErrorMessage(message: string): boolean;
|
|
20
|
+
export declare function getErrorMessage(err: any): string;
|
|
20
21
|
interface CustomAxiosError extends AxiosError {
|
|
21
22
|
data?: any;
|
|
22
23
|
}
|
package/out/util/logger.js
CHANGED
|
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.temporaryErrorDebug = exports.handleUserError = exports.AppModuleAggregateError = exports.AppUserModuleError = exports.AppModuleError = exports.getErrorMessage = exports.isAxiosError = exports.logError = exports.log = exports.withContextError = exports.withContext = exports.prepareContext = exports.initialize = void 0;
|
|
35
|
+
exports.temporaryErrorDebug = exports.handleUserError = exports.AppModuleAggregateError = exports.AppUserModuleError = exports.AppModuleError = exports.getErrorMessage = exports.isInternalErrorMessage = exports.isAxiosError = exports.logError = exports.log = exports.withContextError = exports.withContext = exports.prepareContext = exports.initialize = void 0;
|
|
36
36
|
const logsFormatter = __importStar(require("@crowdin/logs-formatter"));
|
|
37
37
|
const storage_1 = require("../storage");
|
|
38
38
|
let logConfig;
|
|
@@ -166,18 +166,25 @@ function isAxiosError(e) {
|
|
|
166
166
|
return !!e.isAxiosError;
|
|
167
167
|
}
|
|
168
168
|
exports.isAxiosError = isAxiosError;
|
|
169
|
+
function isInternalErrorMessage(message) {
|
|
170
|
+
const internalErrorMessagePrefixes = ['SQL'];
|
|
171
|
+
for (const prefix of internalErrorMessagePrefixes) {
|
|
172
|
+
if (message.startsWith(prefix)) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
exports.isInternalErrorMessage = isInternalErrorMessage;
|
|
169
179
|
function getErrorMessage(err) {
|
|
170
|
-
let message;
|
|
180
|
+
let message = 'Internal Server Error';
|
|
171
181
|
if (typeof err === 'string') {
|
|
172
182
|
message = err;
|
|
173
183
|
}
|
|
174
|
-
else if (err.message) {
|
|
184
|
+
else if (err.message && typeof err.message === 'string') {
|
|
175
185
|
message = err.message;
|
|
176
186
|
}
|
|
177
|
-
|
|
178
|
-
message = 'Internal Server Error';
|
|
179
|
-
}
|
|
180
|
-
return message;
|
|
187
|
+
return isInternalErrorMessage(message) ? 'Internal Server Error' : message;
|
|
181
188
|
}
|
|
182
189
|
exports.getErrorMessage = getErrorMessage;
|
|
183
190
|
class AppModuleError extends Error {
|
package/package.json
CHANGED