@crowdin/app-project-module 0.17.2 → 0.17.4
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/README.md
CHANGED
|
@@ -489,6 +489,7 @@ const configuration = {
|
|
|
489
489
|
signaturePatterns: {
|
|
490
490
|
fileName: '^.+\.xml$'
|
|
491
491
|
},
|
|
492
|
+
customSrxSupported: true,
|
|
492
493
|
parseFile: async (file, req, client, context, projectId) => {
|
|
493
494
|
const xml = convert.xml2json(file, { compact: true, spaces: 4 });
|
|
494
495
|
const fileContent = JSON.parse(xml);
|
package/out/handlers/manifest.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const models_1 = require("../models");
|
|
4
|
+
const connection_1 = require("../util/connection");
|
|
4
5
|
function handle(config) {
|
|
5
6
|
const modules = {};
|
|
6
7
|
if (config.projectIntegration) {
|
|
@@ -21,6 +22,7 @@ function handle(config) {
|
|
|
21
22
|
type: config.customFileFormat.type,
|
|
22
23
|
stringsExport: !!config.customFileFormat.stringsExport,
|
|
23
24
|
multilingual: !!config.customFileFormat.multilingual,
|
|
25
|
+
customSrxSupported: !!config.customFileFormat.customSrxSupported,
|
|
24
26
|
extensions: config.customFileFormat.extensions,
|
|
25
27
|
signaturePatterns: config.customFileFormat.signaturePatterns,
|
|
26
28
|
url: '/process',
|
|
@@ -97,6 +99,13 @@ function handle(config) {
|
|
|
97
99
|
},
|
|
98
100
|
];
|
|
99
101
|
}
|
|
102
|
+
const events = {
|
|
103
|
+
installed: '/installed',
|
|
104
|
+
uninstall: '/uninstall',
|
|
105
|
+
};
|
|
106
|
+
if (!(0, connection_1.isAppFree)(config)) {
|
|
107
|
+
events['subscription_paid'] = '/subscription-paid';
|
|
108
|
+
}
|
|
100
109
|
return (_req, res) => {
|
|
101
110
|
const manifest = {
|
|
102
111
|
identifier: config.identifier,
|
|
@@ -107,10 +116,7 @@ function handle(config) {
|
|
|
107
116
|
type: 'authorization_code',
|
|
108
117
|
clientId: config.clientId,
|
|
109
118
|
},
|
|
110
|
-
events
|
|
111
|
-
installed: '/installed',
|
|
112
|
-
uninstall: '/uninstall',
|
|
113
|
-
},
|
|
119
|
+
events,
|
|
114
120
|
scopes: config.scopes ? config.scopes : [models_1.Scope.PROJECTS],
|
|
115
121
|
modules,
|
|
116
122
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import { Request, Response } from 'express';
|
|
3
|
+
import { Config } from '../models';
|
|
4
|
+
export default function handle(config: Config): (req: Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const util_1 = require("../util");
|
|
13
|
+
const connection_1 = require("../util/connection");
|
|
14
|
+
function handle(config) {
|
|
15
|
+
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const organizationId = (req.query || {})['organization_id'] || (req.body || {})['organization_id'];
|
|
17
|
+
(0, util_1.log)(`Recieved subscription paid request for organization ${organizationId}`, config.logger);
|
|
18
|
+
(0, connection_1.clearCache)(organizationId);
|
|
19
|
+
res.status(204).end();
|
|
20
|
+
}), config.onError);
|
|
21
|
+
}
|
|
22
|
+
exports.default = handle;
|
package/out/index.js
CHANGED
|
@@ -53,6 +53,7 @@ const manifest_1 = __importDefault(require("./handlers/manifest"));
|
|
|
53
53
|
const oauth_login_1 = __importDefault(require("./handlers/oauth-login"));
|
|
54
54
|
const settings_save_1 = __importDefault(require("./handlers/settings-save"));
|
|
55
55
|
const subscription_info_1 = __importDefault(require("./handlers/subscription-info"));
|
|
56
|
+
const subscription_paid_1 = __importDefault(require("./handlers/subscription-paid"));
|
|
56
57
|
const sync_settings_1 = __importDefault(require("./handlers/sync-settings"));
|
|
57
58
|
const sync_settings_save_1 = __importDefault(require("./handlers/sync-settings-save"));
|
|
58
59
|
const uninstall_1 = __importDefault(require("./handlers/uninstall"));
|
|
@@ -61,6 +62,7 @@ const integration_credentials_1 = __importDefault(require("./middlewares/integra
|
|
|
61
62
|
const json_response_1 = __importDefault(require("./middlewares/json-response"));
|
|
62
63
|
const ui_module_1 = __importDefault(require("./middlewares/ui-module"));
|
|
63
64
|
const storage = __importStar(require("./storage"));
|
|
65
|
+
const connection_1 = require("./util/connection");
|
|
64
66
|
const cron_1 = require("./util/cron");
|
|
65
67
|
const defaults_1 = require("./util/defaults");
|
|
66
68
|
var models_1 = require("./models");
|
|
@@ -93,6 +95,9 @@ function addCrowdinEndpoints(app, config) {
|
|
|
93
95
|
app.post('/installed', (0, install_1.default)(config));
|
|
94
96
|
app.post('/uninstall', (0, uninstall_1.default)(config));
|
|
95
97
|
app.get('/manifest.json', json_response_1.default, (0, manifest_1.default)(config));
|
|
98
|
+
if (!(0, connection_1.isAppFree)(config)) {
|
|
99
|
+
app.post('/subscription-paid', (0, subscription_paid_1.default)(config));
|
|
100
|
+
}
|
|
96
101
|
const integrationLogic = config.projectIntegration;
|
|
97
102
|
if (integrationLogic) {
|
|
98
103
|
(0, defaults_1.applyDefaults)(config, integrationLogic);
|
package/out/models/index.d.ts
CHANGED
|
@@ -403,6 +403,10 @@ export interface CustomFileFormatLogic {
|
|
|
403
403
|
* File extensions (used for strings export)
|
|
404
404
|
*/
|
|
405
405
|
extensions?: string[];
|
|
406
|
+
/**
|
|
407
|
+
* Enable custom srx
|
|
408
|
+
*/
|
|
409
|
+
customSrxSupported?: boolean;
|
|
406
410
|
/**
|
|
407
411
|
* Used for initial source file upload, source file update, and translation upload
|
|
408
412
|
*/
|
package/out/storage/index.js
CHANGED
|
@@ -169,7 +169,7 @@ function connect(folder) {
|
|
|
169
169
|
}
|
|
170
170
|
exports.connect = connect;
|
|
171
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 (?, ?, ?, ?, ?, ?, ?, ?, ?)', [
|
|
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
173
|
credentials.id,
|
|
174
174
|
credentials.appSecret,
|
|
175
175
|
credentials.domain,
|
|
@@ -179,6 +179,7 @@ function saveCrowdinCredentials(credentials) {
|
|
|
179
179
|
credentials.accessToken,
|
|
180
180
|
credentials.refreshToken,
|
|
181
181
|
credentials.expire,
|
|
182
|
+
credentials.type,
|
|
182
183
|
]);
|
|
183
184
|
}
|
|
184
185
|
exports.saveCrowdinCredentials = saveCrowdinCredentials;
|
package/package.json
CHANGED