@crowdin/app-project-module 0.29.4 → 0.29.5
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/index.d.ts +2 -0
- package/out/index.js +6 -5
- package/out/static/js/form.js +6 -6
- package/out/storage/postgre.d.ts +1 -0
- package/out/storage/postgre.js +19 -1
- package/out/util/terminus-express.d.ts +7 -0
- package/out/util/terminus-express.js +21 -0
- package/package.json +6 -5
package/out/storage/postgre.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class PostgreStorage implements Storage {
|
|
|
21
21
|
constructor(config: PostgreStorageConfig);
|
|
22
22
|
executeQuery<T>(command: (client: Client) => Promise<T>): Promise<T>;
|
|
23
23
|
migrate(): Promise<void>;
|
|
24
|
+
addColumns(client: Client): Promise<void>;
|
|
24
25
|
addTables(client: Client): Promise<void>;
|
|
25
26
|
saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
|
|
26
27
|
updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
|
package/out/storage/postgre.js
CHANGED
|
@@ -48,6 +48,8 @@ class PostgreStorage {
|
|
|
48
48
|
try {
|
|
49
49
|
yield this.executeQuery(this.addTables);
|
|
50
50
|
this._res && this._res();
|
|
51
|
+
// TODO: temporary code
|
|
52
|
+
yield this.executeQuery(this.addColumns);
|
|
51
53
|
}
|
|
52
54
|
catch (e) {
|
|
53
55
|
console.error(e);
|
|
@@ -55,6 +57,22 @@ class PostgreStorage {
|
|
|
55
57
|
}
|
|
56
58
|
});
|
|
57
59
|
}
|
|
60
|
+
addColumns(client) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const tableName = 'app_metadata';
|
|
63
|
+
const newColumns = ['crowdin_id'];
|
|
64
|
+
const tableInfo = yield client.query('SELECT column_name FROM information_schema.columns WHERE table_name = $1', [tableName]);
|
|
65
|
+
tableInfo.rows.map((columnInfo) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const index = newColumns.indexOf(columnInfo.column_name);
|
|
67
|
+
if (~index) {
|
|
68
|
+
newColumns.splice(index, 1);
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
71
|
+
for (const column of newColumns) {
|
|
72
|
+
yield client.query(`ALTER TABLE ${tableName} ADD COLUMN ${column} varchar NULL;`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
58
76
|
addTables(client) {
|
|
59
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
78
|
yield client.query(`
|
|
@@ -97,7 +115,7 @@ class PostgreStorage {
|
|
|
97
115
|
(
|
|
98
116
|
id varchar primary key,
|
|
99
117
|
data varchar,
|
|
100
|
-
crowdin_id varchar
|
|
118
|
+
crowdin_id varchar
|
|
101
119
|
)
|
|
102
120
|
`);
|
|
103
121
|
yield client.query(`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const express_1 = __importDefault(require("express"));
|
|
7
|
+
const terminus_1 = require("@godaddy/terminus");
|
|
8
|
+
express_1.default.application.baseListen = express_1.default.application.listen;
|
|
9
|
+
express_1.default.application.listen = function (...args) {
|
|
10
|
+
const [port, callback] = args;
|
|
11
|
+
const server = this.baseListen.call(this, port);
|
|
12
|
+
if (callback) {
|
|
13
|
+
callback();
|
|
14
|
+
}
|
|
15
|
+
(0, terminus_1.createTerminus)(server, {
|
|
16
|
+
timeout: Infinity,
|
|
17
|
+
useExit0: true,
|
|
18
|
+
});
|
|
19
|
+
return server;
|
|
20
|
+
};
|
|
21
|
+
exports.default = express_1.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crowdin/app-project-module",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.5",
|
|
4
4
|
"description": "Module that generates for you all common endpoints for serving standalone Crowdin App",
|
|
5
5
|
"main": "out/index.js",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@crowdin/crowdin-apps-functions": "0.5.1",
|
|
18
|
+
"@godaddy/terminus": "^4.12.1",
|
|
18
19
|
"@types/pg": "^8.6.6",
|
|
19
20
|
"amqplib": "^0.10.3",
|
|
20
21
|
"crypto-js": "^4.0.0",
|
|
21
22
|
"express": "4.18.2",
|
|
22
|
-
"express-handlebars": "^5.3.
|
|
23
|
+
"express-handlebars": "^5.3.5",
|
|
23
24
|
"mysql2": "^2.3.3",
|
|
24
25
|
"node-cron": "^3.0.2",
|
|
25
26
|
"pg": "^8.10.0",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@babel/preset-react": "^7.22.3",
|
|
33
|
-
"@emotion/react": "^11.
|
|
34
|
+
"@emotion/react": "^11.11.1",
|
|
34
35
|
"@emotion/styled": "^11.10.6",
|
|
35
36
|
"@mui/icons-material": "^5.11.16",
|
|
36
37
|
"@mui/material": "^5.11.12",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"@rollup/plugin-replace": "^5.0.2",
|
|
46
47
|
"@rollup/plugin-terser": "^0.4.0",
|
|
47
48
|
"@types/amqplib": "^0.10.1",
|
|
48
|
-
"@types/crypto-js": "^4.
|
|
49
|
+
"@types/crypto-js": "^4.1.1",
|
|
49
50
|
"@types/express": "4.17.17",
|
|
50
51
|
"@types/express-handlebars": "^5.3.1",
|
|
51
52
|
"@types/jest": "^29.5.2",
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"react": "^18.2.0",
|
|
64
65
|
"react-dom": "^18.2.0",
|
|
65
66
|
"rollup": "^3.20.2",
|
|
66
|
-
"ts-jest": "^29.1.
|
|
67
|
+
"ts-jest": "^29.1.1",
|
|
67
68
|
"typescript": "^4.9.5"
|
|
68
69
|
},
|
|
69
70
|
"repository": {
|