@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
|
@@ -1,25 +0,0 @@
|
|
|
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 defaults_1 = require("../util/defaults");
|
|
14
|
-
function handle(config, integration) {
|
|
15
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
(0, util_1.log)('Upading integratino data', config.logger);
|
|
17
|
-
const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, req.crowdinApiClient, req.crowdinContext.jwtPayload.context.project_id);
|
|
18
|
-
if (rootFolder) {
|
|
19
|
-
(0, util_1.log)(`Upading integration data for crowding root folder ${rootFolder.id}`, config.logger);
|
|
20
|
-
}
|
|
21
|
-
yield integration.updateIntegration(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, req.integrationCredentials, req.body, rootFolder, req.integrationSettings);
|
|
22
|
-
res.status(204).end();
|
|
23
|
-
}), config.onError);
|
|
24
|
-
}
|
|
25
|
-
exports.default = handle;
|
package/out/handlers/main.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { Response } from 'express';
|
|
3
|
-
import { Config, IntegrationLogic } from '../models';
|
|
4
|
-
export default function handle(config: Config, integration: IntegrationLogic): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
package/out/handlers/main.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
const defaults_1 = require("../util/defaults");
|
|
15
|
-
function constructOauthUrl(config, integration) {
|
|
16
|
-
var _a, _b, _c;
|
|
17
|
-
const oauth = integration.oauthLogin;
|
|
18
|
-
let url = (oauth === null || oauth === void 0 ? void 0 : oauth.authorizationUrl) || '';
|
|
19
|
-
url += `?${((_a = oauth === null || oauth === void 0 ? void 0 : oauth.fieldsMapping) === null || _a === void 0 ? void 0 : _a.clientId) || 'client_id'}=${oauth === null || oauth === void 0 ? void 0 : oauth.clientId}`;
|
|
20
|
-
url += `&${((_b = oauth === null || oauth === void 0 ? void 0 : oauth.fieldsMapping) === null || _b === void 0 ? void 0 : _b.redirectUri) || 'redirect_uri'}=${config.baseUrl}${(0, defaults_1.getOauthRoute)(integration)}`;
|
|
21
|
-
if (oauth === null || oauth === void 0 ? void 0 : oauth.scope) {
|
|
22
|
-
url += `&${((_c = oauth === null || oauth === void 0 ? void 0 : oauth.fieldsMapping) === null || _c === void 0 ? void 0 : _c.scope) || 'scope'}=${oauth === null || oauth === void 0 ? void 0 : oauth.scope}`;
|
|
23
|
-
}
|
|
24
|
-
if (oauth === null || oauth === void 0 ? void 0 : oauth.extraAutorizationUrlParameters) {
|
|
25
|
-
Object.entries(oauth === null || oauth === void 0 ? void 0 : oauth.extraAutorizationUrlParameters).forEach(([key, value]) => (url += `&${key}=${value}`));
|
|
26
|
-
}
|
|
27
|
-
return url;
|
|
28
|
-
}
|
|
29
|
-
function handle(config, integration) {
|
|
30
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var _a;
|
|
32
|
-
const installed = !!req.crowdinApiClient;
|
|
33
|
-
const loggedIn = !!req.integrationCredentials;
|
|
34
|
-
const options = {
|
|
35
|
-
name: config.name,
|
|
36
|
-
};
|
|
37
|
-
let view = 'main';
|
|
38
|
-
if (!installed) {
|
|
39
|
-
view = 'install';
|
|
40
|
-
}
|
|
41
|
-
else if (!loggedIn) {
|
|
42
|
-
view = 'login';
|
|
43
|
-
options.loginFields = (_a = integration.loginForm) === null || _a === void 0 ? void 0 : _a.fields;
|
|
44
|
-
if (integration.oauthLogin) {
|
|
45
|
-
options.oauthUrl = constructOauthUrl(config, integration);
|
|
46
|
-
(0, util_1.log)(`Adding oauth url ${options.oauthUrl}`, config.logger);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else if (integration.getConfiguration) {
|
|
50
|
-
const configurationFields = yield integration.getConfiguration(req.crowdinContext.jwtPayload.context.project_id, req.crowdinApiClient, req.integrationCredentials);
|
|
51
|
-
options.configurationFields = configurationFields;
|
|
52
|
-
options.config = JSON.stringify(req.integrationSettings || {});
|
|
53
|
-
options.reloadOnConfigSave = !!integration.reloadOnConfigSave;
|
|
54
|
-
(0, util_1.log)(`Adding configuration fields ${JSON.stringify(configurationFields, null, 2)}`, config.logger);
|
|
55
|
-
}
|
|
56
|
-
options.infoModal = integration.infoModal;
|
|
57
|
-
options.withCronSync = integration.withCronSync;
|
|
58
|
-
options.withWebhookSync = integration.withWebhookSync;
|
|
59
|
-
options.checkSubscription = !(0, connection_1.isAppFree)(config);
|
|
60
|
-
(0, util_1.log)(`Routing user to ${view} view`, config.logger);
|
|
61
|
-
return res.render(view, options);
|
|
62
|
-
}), config.onError);
|
|
63
|
-
}
|
|
64
|
-
exports.default = handle;
|
package/out/handlers/manifest.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const models_1 = require("../models");
|
|
4
|
-
const connection_1 = require("../util/connection");
|
|
5
|
-
function handle(config) {
|
|
6
|
-
const modules = {};
|
|
7
|
-
if (config.projectIntegration) {
|
|
8
|
-
modules['project-integrations'] = [
|
|
9
|
-
{
|
|
10
|
-
key: config.identifier + '-int',
|
|
11
|
-
name: config.name,
|
|
12
|
-
description: config.description,
|
|
13
|
-
logo: '/logo/integration/logo.png',
|
|
14
|
-
url: '/',
|
|
15
|
-
},
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
if (config.customFileFormat) {
|
|
19
|
-
modules['custom-file-format'] = [
|
|
20
|
-
{
|
|
21
|
-
key: config.identifier + '-ff',
|
|
22
|
-
type: config.customFileFormat.type,
|
|
23
|
-
stringsExport: !!config.customFileFormat.stringsExport,
|
|
24
|
-
multilingual: !!config.customFileFormat.multilingual,
|
|
25
|
-
customSrxSupported: !!config.customFileFormat.customSrxSupported,
|
|
26
|
-
extensions: config.customFileFormat.extensions,
|
|
27
|
-
signaturePatterns: config.customFileFormat.signaturePatterns,
|
|
28
|
-
url: '/process',
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
if (config.customMT) {
|
|
33
|
-
modules['custom-mt'] = [
|
|
34
|
-
{
|
|
35
|
-
key: config.identifier + '-mt',
|
|
36
|
-
name: config.name,
|
|
37
|
-
url: '/translate',
|
|
38
|
-
},
|
|
39
|
-
];
|
|
40
|
-
}
|
|
41
|
-
if (config.organizationMenu) {
|
|
42
|
-
modules['organization-menu'] = [
|
|
43
|
-
{
|
|
44
|
-
key: config.identifier + '-resources',
|
|
45
|
-
name: config.name,
|
|
46
|
-
url: '/resources/' + (config.organizationMenu.fileName || 'index.html'),
|
|
47
|
-
icon: '/logo/resources/logo.png',
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
|
-
if (config.profileResourcesMenu) {
|
|
52
|
-
modules['profile-resources-menu'] = [
|
|
53
|
-
{
|
|
54
|
-
key: config.identifier + '-profile-resources-menu',
|
|
55
|
-
name: config.name,
|
|
56
|
-
url: '/resources/' + (config.profileResourcesMenu.fileName || 'index.html'),
|
|
57
|
-
icon: '/logo/resources/logo.png',
|
|
58
|
-
},
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
if (config.editorRightPanel) {
|
|
62
|
-
modules['editor-right-panel'] = [
|
|
63
|
-
{
|
|
64
|
-
key: config.identifier + '-editor-panels',
|
|
65
|
-
name: config.name,
|
|
66
|
-
url: '/editor-panels/' + (config.editorRightPanel.fileName || 'index.html'),
|
|
67
|
-
modes: config.editorRightPanel.modes,
|
|
68
|
-
},
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
if (config.projectMenu) {
|
|
72
|
-
modules['project-menu'] = [
|
|
73
|
-
{
|
|
74
|
-
key: config.identifier + '-project-menu',
|
|
75
|
-
name: config.name,
|
|
76
|
-
url: '/project-menu/' + (config.projectMenu.fileName || 'index.html'),
|
|
77
|
-
},
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
if (config.projectTools) {
|
|
81
|
-
modules['project-tools'] = [
|
|
82
|
-
{
|
|
83
|
-
key: config.identifier + '-tools',
|
|
84
|
-
name: config.name,
|
|
85
|
-
description: config.description,
|
|
86
|
-
logo: '/logo/tools/logo.png',
|
|
87
|
-
url: '/tools/' + (config.projectTools.fileName || 'index.html'),
|
|
88
|
-
},
|
|
89
|
-
];
|
|
90
|
-
}
|
|
91
|
-
if (config.projectReports) {
|
|
92
|
-
modules['project-reports'] = [
|
|
93
|
-
{
|
|
94
|
-
key: config.identifier + '-project-reports',
|
|
95
|
-
name: config.name,
|
|
96
|
-
description: config.description,
|
|
97
|
-
logo: '/logo/reports/logo.png',
|
|
98
|
-
url: '/reports/' + (config.projectReports.fileName || 'index.html'),
|
|
99
|
-
},
|
|
100
|
-
];
|
|
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
|
-
}
|
|
109
|
-
return (_req, res) => {
|
|
110
|
-
const manifest = {
|
|
111
|
-
identifier: config.identifier,
|
|
112
|
-
name: config.name,
|
|
113
|
-
logo: '/logo.png',
|
|
114
|
-
baseUrl: config.baseUrl,
|
|
115
|
-
authentication: {
|
|
116
|
-
type: 'authorization_code',
|
|
117
|
-
clientId: config.clientId,
|
|
118
|
-
},
|
|
119
|
-
events,
|
|
120
|
-
scopes: config.scopes ? config.scopes : [models_1.Scope.PROJECTS],
|
|
121
|
-
modules,
|
|
122
|
-
};
|
|
123
|
-
res.send(manifest);
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
exports.default = handle;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { Request, Response } from 'express';
|
|
3
|
-
import { Config, IntegrationLogic } from '../models';
|
|
4
|
-
export default function handle(config: Config, integration: IntegrationLogic): (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;
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
|
-
const util_1 = require("../util");
|
|
17
|
-
const defaults_1 = require("../util/defaults");
|
|
18
|
-
function handle(config, integration) {
|
|
19
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
21
|
-
const message = {
|
|
22
|
-
uid: 'oauth_popup',
|
|
23
|
-
};
|
|
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)(`Recieved request from OAuth login callback. Code ${code}`, config.logger);
|
|
26
|
-
try {
|
|
27
|
-
const oauthLogin = integration.oauthLogin;
|
|
28
|
-
let credentials;
|
|
29
|
-
if (oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.performGetTokenRequest) {
|
|
30
|
-
(0, util_1.log)('Performing custom get bearer token request', config.logger);
|
|
31
|
-
credentials = yield oauthLogin.performGetTokenRequest(code);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
const request = {};
|
|
35
|
-
const oauthLogin = integration.oauthLogin;
|
|
36
|
-
request[((_c = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _c === void 0 ? void 0 : _c.code) || 'code'] = code;
|
|
37
|
-
request[((_d = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _d === void 0 ? void 0 : _d.clientId) || 'client_id'] = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.clientId;
|
|
38
|
-
request[((_e = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _e === void 0 ? void 0 : _e.clientSecret) || 'client_secret'] = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.clientSecret;
|
|
39
|
-
request[((_f = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _f === void 0 ? void 0 : _f.redirectUri) || 'redirect_uri'] = `${config.baseUrl}${(0, defaults_1.getOauthRoute)(integration)}`;
|
|
40
|
-
if (oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.extraAccessTokenParameters) {
|
|
41
|
-
Object.entries(oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.extraAccessTokenParameters).forEach(([key, value]) => (request[key] = value));
|
|
42
|
-
}
|
|
43
|
-
credentials = (yield axios_1.default.post(((_g = integration.oauthLogin) === null || _g === void 0 ? void 0 : _g.accessTokenUrl) || '', request, {
|
|
44
|
-
headers: { Accept: 'application/json' },
|
|
45
|
-
})).data;
|
|
46
|
-
}
|
|
47
|
-
const oauthCredentials = {};
|
|
48
|
-
oauthCredentials.accessToken = credentials[((_h = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _h === void 0 ? void 0 : _h.accessToken) || 'access_token'];
|
|
49
|
-
if (oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.refresh) {
|
|
50
|
-
oauthCredentials.refreshToken = credentials[((_j = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _j === void 0 ? void 0 : _j.refreshToken) || 'refresh_token'];
|
|
51
|
-
oauthCredentials.expireIn =
|
|
52
|
-
Number(credentials[((_k = oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.fieldsMapping) === null || _k === void 0 ? void 0 : _k.expiresIn) || 'expires_in']) + Date.now() / 1000;
|
|
53
|
-
}
|
|
54
|
-
message.data = oauthCredentials;
|
|
55
|
-
return res.render('oauth', { message: JSON.stringify(message) });
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
if (config.onError) {
|
|
59
|
-
config.onError(e);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.error(e);
|
|
63
|
-
}
|
|
64
|
-
message.data = { error: (0, util_1.getMessage)(e) };
|
|
65
|
-
return res.render('oauth', { message: JSON.stringify(message) });
|
|
66
|
-
}
|
|
67
|
-
}), config.onError);
|
|
68
|
-
}
|
|
69
|
-
exports.default = handle;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { Response } from 'express';
|
|
3
|
-
import { Config } from '../models';
|
|
4
|
-
export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -1,21 +0,0 @@
|
|
|
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 storage_1 = require("../storage");
|
|
13
|
-
const util_1 = require("../util");
|
|
14
|
-
function handle(config) {
|
|
15
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
(0, util_1.log)(`Saving settings ${JSON.stringify(req.body.config, null, 2)}`, config.logger);
|
|
17
|
-
yield (0, storage_1.updateIntegrationConfig)(req.crowdinContext.clientId, JSON.stringify(req.body.config));
|
|
18
|
-
res.status(204).end();
|
|
19
|
-
}), config.onError);
|
|
20
|
-
}
|
|
21
|
-
exports.default = handle;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const models_1 = require("../models");
|
|
4
|
-
function handle(config) {
|
|
5
|
-
return (req, res) => {
|
|
6
|
-
var _a;
|
|
7
|
-
const subscriptionInfo = req.subscriptionInfo;
|
|
8
|
-
let showInfo = (subscriptionInfo === null || subscriptionInfo === void 0 ? void 0 : subscriptionInfo.type) === models_1.SubscriptionInfoType.TRIAL;
|
|
9
|
-
if (showInfo && ((_a = config.pricing) === null || _a === void 0 ? void 0 : _a.infoDisplayDaysThreshold)) {
|
|
10
|
-
showInfo = config.pricing.infoDisplayDaysThreshold >= ((subscriptionInfo === null || subscriptionInfo === void 0 ? void 0 : subscriptionInfo.daysLeft) || 0);
|
|
11
|
-
}
|
|
12
|
-
res.send(Object.assign(Object.assign({}, (subscriptionInfo || {})), { showInfo }));
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
exports.default = handle;
|
|
@@ -1,4 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { Response } from 'express';
|
|
3
|
-
import { Config } from '../models';
|
|
4
|
-
export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -1,29 +0,0 @@
|
|
|
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 storage_1 = require("../storage");
|
|
13
|
-
const util_1 = require("../util");
|
|
14
|
-
function handle(config) {
|
|
15
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const { files, type, provider } = req.body;
|
|
17
|
-
const existingSettings = yield (0, storage_1.getSyncSettings)(req.crowdinContext.clientId, req.crowdinContext.crowdinId, type, provider);
|
|
18
|
-
if (existingSettings) {
|
|
19
|
-
(0, util_1.log)(`Updating sync settings for type ${type} and provider ${provider} ${JSON.stringify(files, null, 2)}`, config.logger);
|
|
20
|
-
yield (0, storage_1.updateSyncSettings)(JSON.stringify(files), req.crowdinContext.clientId, req.crowdinContext.crowdinId, type, provider);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
(0, util_1.log)(`Saving sync settings for type ${type} and provider ${provider} ${JSON.stringify(files, null, 2)}`, config.logger);
|
|
24
|
-
yield (0, storage_1.saveSyncSettings)(JSON.stringify(files), req.crowdinContext.clientId, req.crowdinContext.crowdinId, type, provider);
|
|
25
|
-
}
|
|
26
|
-
res.status(204).end();
|
|
27
|
-
}), config.onError);
|
|
28
|
-
}
|
|
29
|
-
exports.default = handle;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { Response } from 'express';
|
|
3
|
-
import { Config } from '../models';
|
|
4
|
-
export default function handle(config: Config): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -1,27 +0,0 @@
|
|
|
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 storage_1 = require("../storage");
|
|
13
|
-
const util_1 = require("../util");
|
|
14
|
-
function handle(config) {
|
|
15
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
let files = {};
|
|
17
|
-
const provider = req.params.provider;
|
|
18
|
-
(0, util_1.log)(`Loading sync settings for provider ${provider}`, config.logger);
|
|
19
|
-
const syncSettings = yield (0, storage_1.getSyncSettingsByProvider)(req.crowdinContext.clientId, provider);
|
|
20
|
-
if (syncSettings) {
|
|
21
|
-
files = JSON.parse(syncSettings.files) || [];
|
|
22
|
-
}
|
|
23
|
-
(0, util_1.log)(`Returning sync settings ${JSON.stringify(files, null, 2)}`, config.logger);
|
|
24
|
-
res.send(files);
|
|
25
|
-
}), config.onError);
|
|
26
|
-
}
|
|
27
|
-
exports.default = handle;
|
|
@@ -1,4 +0,0 @@
|
|
|
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;
|
|
@@ -1,27 +0,0 @@
|
|
|
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 storage_1 = require("../storage");
|
|
13
|
-
const util_1 = require("../util");
|
|
14
|
-
function handle(config) {
|
|
15
|
-
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
const event = req.body;
|
|
17
|
-
(0, util_1.log)(`Recieved uninstall request ${JSON.stringify(event, null, 2)}`, config.logger);
|
|
18
|
-
const organization = (event.domain || event.organizationId).toString();
|
|
19
|
-
yield (0, storage_1.deleteCrowdinCredentials)(organization);
|
|
20
|
-
if (config.onUninstall) {
|
|
21
|
-
yield config.onUninstall(organization);
|
|
22
|
-
}
|
|
23
|
-
(0, util_1.log)('App has been uninstalled', config.logger);
|
|
24
|
-
res.status(204).end();
|
|
25
|
-
}), config.onError);
|
|
26
|
-
}
|
|
27
|
-
exports.default = handle;
|
package/out/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Express } from 'express';
|
|
2
|
-
import { Config, CrowdinAppUtilities } from './models';
|
|
3
|
-
export { Scope } from './models';
|
|
4
|
-
export declare function addCrowdinEndpoints(app: Express, config: Config): CrowdinAppUtilities;
|
|
5
|
-
export declare function createApp(config: Config): void;
|