@crowdin/app-project-module 1.2.0 → 1.3.0
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/app-test/integration/get-integration-files.js +1 -1
- package/out/app-test/integration/index.js +6 -6
- package/out/app-test/integration/mocks/crowdin-storage.d.ts +16 -16
- package/out/app-test/integration/mocks/mock-crowdin-api-client.js +17 -7
- package/out/app-test/integration/update-crowdin.js +1 -1
- package/out/app-test/integration/update-integration.js +1 -1
- package/out/app-test/util/index.js +1 -2
- package/out/index.js +23 -13
- package/out/middlewares/api-call.js +1 -1
- package/out/middlewares/auto-credentials-masker.js +2 -3
- package/out/middlewares/crowdin-client.d.ts +1 -2
- package/out/middlewares/crowdin-client.js +5 -6
- package/out/middlewares/integration-credentials.d.ts +1 -2
- package/out/middlewares/integration-credentials.js +18 -8
- package/out/middlewares/json-response.js +1 -1
- package/out/middlewares/render-ui-module.d.ts +1 -2
- package/out/middlewares/render-ui-module.js +1 -1
- package/out/middlewares/ui-module.d.ts +1 -2
- package/out/middlewares/ui-module.js +1 -1
- package/out/modules/about.js +2 -3
- package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -2
- package/out/modules/ai-prompt-provider/handlers/compile.js +1 -1
- package/out/modules/ai-prompt-provider/index.js +1 -2
- package/out/modules/ai-prompt-provider/types.js +1 -1
- package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -2
- package/out/modules/ai-provider/handlers/chat-completions.js +2 -2
- package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -2
- package/out/modules/ai-provider/handlers/get-model-list.js +1 -1
- package/out/modules/ai-provider/index.js +1 -2
- package/out/modules/ai-provider/util/index.js +6 -6
- package/out/modules/ai-request-processors/handler.d.ts +1 -2
- package/out/modules/ai-request-processors/handler.js +1 -1
- package/out/modules/ai-request-processors/index.js +5 -5
- package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -2
- package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
- package/out/modules/ai-tools/index.js +2 -3
- package/out/modules/ai-tools/util/index.js +4 -5
- package/out/modules/api/api.js +4 -5
- package/out/modules/api/index.js +1 -2
- package/out/modules/api/types.js +1 -1
- package/out/modules/auth-guard/handlers/verify.d.ts +1 -2
- package/out/modules/auth-guard/handlers/verify.js +1 -1
- package/out/modules/auth-guard/index.js +1 -2
- package/out/modules/automation-action/handlers/execute.d.ts +1 -2
- package/out/modules/automation-action/handlers/execute.js +1 -1
- package/out/modules/automation-action/handlers/input-schema.d.ts +1 -2
- package/out/modules/automation-action/handlers/input-schema.js +1 -1
- package/out/modules/automation-action/handlers/output-schema.d.ts +1 -2
- package/out/modules/automation-action/handlers/output-schema.js +1 -1
- package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -2
- package/out/modules/automation-action/handlers/validate-settings.js +1 -1
- package/out/modules/automation-action/index.js +1 -2
- package/out/modules/automation-action/util/index.js +2 -3
- package/out/modules/automation-action/util/validate-input.js +1 -2
- package/out/modules/context-menu/index.js +1 -2
- package/out/modules/context-menu/types.js +2 -2
- package/out/modules/custom-mt/handlers/translate.d.ts +1 -2
- package/out/modules/custom-mt/handlers/translate.js +1 -1
- package/out/modules/custom-mt/index.js +1 -2
- package/out/modules/custom-mt/types.d.ts +0 -2
- package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -2
- package/out/modules/custom-spell-check/handlers/get-languages-list.js +1 -1
- package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -2
- package/out/modules/custom-spell-check/handlers/spell-check.js +1 -1
- package/out/modules/custom-spell-check/index.js +1 -2
- package/out/modules/editor-right-panel/index.js +1 -2
- package/out/modules/external-qa-check/handlers/validate.d.ts +1 -2
- package/out/modules/external-qa-check/handlers/validate.js +1 -1
- package/out/modules/external-qa-check/index.js +1 -2
- package/out/modules/file-processing/handlers/custom-file-format.d.ts +1 -2
- package/out/modules/file-processing/handlers/custom-file-format.js +9 -9
- package/out/modules/file-processing/handlers/file-download.d.ts +1 -2
- package/out/modules/file-processing/handlers/file-download.js +1 -1
- package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -2
- package/out/modules/file-processing/handlers/pre-post-process.js +1 -1
- package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -2
- package/out/modules/file-processing/handlers/translations-alignment.js +1 -1
- package/out/modules/file-processing/index.js +6 -7
- package/out/modules/file-processing/types.d.ts +0 -2
- package/out/modules/file-processing/types.js +1 -1
- package/out/modules/file-processing/util/defaults.js +18 -9
- package/out/modules/file-processing/util/files.d.ts +0 -2
- package/out/modules/file-processing/util/files.js +4 -4
- package/out/modules/form-data-display.d.ts +1 -2
- package/out/modules/form-data-display.js +18 -8
- package/out/modules/form-data-save.d.ts +1 -2
- package/out/modules/form-data-save.js +18 -8
- package/out/modules/install.d.ts +1 -2
- package/out/modules/install.js +2 -2
- package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-file-progress.js +1 -1
- package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-files-target-languages.js +1 -1
- package/out/modules/integration/handlers/crowdin-files.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-files.js +1 -1
- package/out/modules/integration/handlers/crowdin-project.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-project.js +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-update.js +1 -1
- package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -2
- package/out/modules/integration/handlers/crowdin-webhook.js +2 -2
- package/out/modules/integration/handlers/integration-data.d.ts +1 -2
- package/out/modules/integration/handlers/integration-data.js +1 -1
- package/out/modules/integration/handlers/integration-login.d.ts +1 -2
- package/out/modules/integration/handlers/integration-login.js +1 -1
- package/out/modules/integration/handlers/integration-logout.d.ts +1 -2
- package/out/modules/integration/handlers/integration-logout.js +18 -8
- package/out/modules/integration/handlers/integration-update.d.ts +1 -2
- package/out/modules/integration/handlers/integration-update.js +1 -1
- package/out/modules/integration/handlers/integration-webhook.d.ts +1 -2
- package/out/modules/integration/handlers/integration-webhook.js +1 -1
- package/out/modules/integration/handlers/invite-users.d.ts +1 -2
- package/out/modules/integration/handlers/invite-users.js +1 -1
- package/out/modules/integration/handlers/job-cancel.d.ts +1 -2
- package/out/modules/integration/handlers/job-cancel.js +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -2
- package/out/modules/integration/handlers/job-info-deprecated.js +1 -1
- package/out/modules/integration/handlers/job-info.d.ts +1 -2
- package/out/modules/integration/handlers/job-info.js +1 -1
- package/out/modules/integration/handlers/job-list.d.ts +1 -2
- package/out/modules/integration/handlers/job-list.js +1 -1
- package/out/modules/integration/handlers/main.d.ts +1 -2
- package/out/modules/integration/handlers/main.js +1 -1
- package/out/modules/integration/handlers/oauth-login.d.ts +1 -2
- package/out/modules/integration/handlers/oauth-login.js +1 -1
- package/out/modules/integration/handlers/oauth-polling.d.ts +1 -2
- package/out/modules/integration/handlers/oauth-polling.js +1 -1
- package/out/modules/integration/handlers/oauth-url.d.ts +1 -2
- package/out/modules/integration/handlers/oauth-url.js +1 -1
- package/out/modules/integration/handlers/settings-save.d.ts +1 -2
- package/out/modules/integration/handlers/settings-save.js +1 -1
- package/out/modules/integration/handlers/settings.d.ts +1 -2
- package/out/modules/integration/handlers/settings.js +1 -1
- package/out/modules/integration/handlers/subscription-info.js +1 -1
- package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -2
- package/out/modules/integration/handlers/sync-settings-save.js +1 -1
- package/out/modules/integration/handlers/sync-settings.d.ts +1 -2
- package/out/modules/integration/handlers/sync-settings.js +1 -1
- package/out/modules/integration/handlers/user-errors.d.ts +1 -2
- package/out/modules/integration/handlers/user-errors.js +1 -1
- package/out/modules/integration/handlers/users.d.ts +1 -2
- package/out/modules/integration/handlers/users.js +4 -5
- package/out/modules/integration/index.js +1 -2
- package/out/modules/integration/types.js +4 -4
- package/out/modules/integration/util/cron.js +46 -37
- package/out/modules/integration/util/defaults.js +33 -24
- package/out/modules/integration/util/files.js +29 -30
- package/out/modules/integration/util/job.js +29 -20
- package/out/modules/integration/util/snapshot.js +7 -8
- package/out/modules/integration/util/types.js +3 -3
- package/out/modules/integration/util/webhooks.js +54 -44
- package/out/modules/manifest.js +1 -1
- package/out/modules/modal/index.js +1 -2
- package/out/modules/organization-menu/index.js +1 -2
- package/out/modules/organization-settings-menu/index.js +1 -2
- package/out/modules/profile-resources-menu/index.js +1 -2
- package/out/modules/profile-settings-menu/index.js +1 -2
- package/out/modules/project-menu/index.js +1 -2
- package/out/modules/project-menu-crowdsource/index.js +1 -2
- package/out/modules/project-reports/index.js +1 -2
- package/out/modules/project-tools/index.js +1 -2
- package/out/modules/status.d.ts +1 -2
- package/out/modules/status.js +1 -1
- package/out/modules/subscription-paid.d.ts +1 -2
- package/out/modules/subscription-paid.js +1 -1
- package/out/modules/uninstall.d.ts +1 -2
- package/out/modules/uninstall.js +1 -1
- package/out/modules/webhooks/handlers/webhook-handler.d.ts +1 -2
- package/out/modules/webhooks/handlers/webhook-handler.js +18 -9
- package/out/modules/webhooks/index.js +1 -2
- package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -2
- package/out/modules/workflow-step-type/handlers/delete-step.js +18 -8
- package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -2
- package/out/modules/workflow-step-type/handlers/step-settings-save.js +18 -8
- package/out/modules/workflow-step-type/index.js +1 -2
- package/out/modules/workflow-step-type/types.js +1 -1
- package/out/modules/workflow-step-type/util/index.js +2 -3
- package/out/static/ui/error.bundle.js +446 -379
- package/out/static/ui/error.bundle.js.map +1 -1
- package/out/static/ui/form.bundle.js +29793 -29989
- package/out/static/ui/form.bundle.js.map +1 -1
- package/out/static/ui/install.bundle.js +446 -379
- package/out/static/ui/install.bundle.js.map +1 -1
- package/out/static/ui/login.bundle.js +448 -379
- package/out/static/ui/login.bundle.js.map +1 -1
- package/out/static/ui/main.bundle.js +448 -379
- package/out/static/ui/main.bundle.js.map +1 -1
- package/out/static/ui/oauth.bundle.js +448 -379
- package/out/static/ui/oauth.bundle.js.map +1 -1
- package/out/storage/d1.js +9 -9
- package/out/storage/index.js +24 -10
- package/out/storage/mysql.js +31 -31
- package/out/storage/postgre.js +31 -31
- package/out/storage/sqlite.js +9 -8
- package/out/types.d.ts +0 -2
- package/out/types.js +8 -8
- package/out/util/connection.js +34 -25
- package/out/util/credentials-masker.d.ts +1 -2
- package/out/util/credentials-masker.js +3 -4
- package/out/util/cron.js +20 -10
- package/out/util/form-schema.js +2 -3
- package/out/util/index.js +38 -28
- package/out/util/jsx-renderer.js +2 -3
- package/out/util/logger.js +41 -31
- package/out/util/static-files.d.ts +0 -1
- package/out/util/static-files.js +2 -3
- package/out/util/subscription.js +11 -12
- package/out/views/FormPage.js +3 -3
- package/package.json +28 -33
package/out/util/connection.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -35,7 +45,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
45
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
46
|
};
|
|
37
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.
|
|
48
|
+
exports.prepareCrowdinClient = prepareCrowdinClient;
|
|
49
|
+
exports.prepareIntegrationCredentials = prepareIntegrationCredentials;
|
|
39
50
|
const crowdin_api_client_1 = __importDefault(require("@crowdin/crowdin-api-client"));
|
|
40
51
|
const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
41
52
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -48,9 +59,9 @@ const os = __importStar(require("os"));
|
|
|
48
59
|
const defaults_1 = require("../modules/integration/util/defaults");
|
|
49
60
|
const crowdinAppFunctions = __importStar(require("@crowdin/crowdin-apps-functions"));
|
|
50
61
|
const axiosCustom = new axios_2.AxiosProvider().axios;
|
|
51
|
-
function prepareCrowdinClient(
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
function prepareCrowdinClient(_a) {
|
|
63
|
+
return __awaiter(this, arguments, void 0, function* ({ config, credentials, autoRenew = false, context, }) {
|
|
64
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
65
|
let userAgent;
|
|
55
66
|
if (config.crowdinApiUserAgent) {
|
|
56
67
|
userAgent = config.crowdinApiUserAgent;
|
|
@@ -62,7 +73,7 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
62
73
|
const isExpired = +credentials.expire - 120 < Date.now() / 1000;
|
|
63
74
|
const organization = credentials.type === types_1.AccountType.ENTERPRISE ? credentials.id : undefined;
|
|
64
75
|
if (config.authenticationType === types_1.AuthenticationType.APP_WITH_CODE) {
|
|
65
|
-
const code = (
|
|
76
|
+
const code = (_b = context === null || context === void 0 ? void 0 : context.jwtPayload) === null || _b === void 0 ? void 0 : _b.code;
|
|
66
77
|
if (!code) {
|
|
67
78
|
throw new Error(`Missing code in JWT payload for ${types_1.AuthenticationType.APP_WITH_CODE} authentication`);
|
|
68
79
|
}
|
|
@@ -74,15 +85,15 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
74
85
|
domain: credentials.domain || '',
|
|
75
86
|
userId: credentials.userId,
|
|
76
87
|
code,
|
|
77
|
-
url: (
|
|
88
|
+
url: (_c = config.crowdinUrls) === null || _c === void 0 ? void 0 : _c.accountUrl,
|
|
78
89
|
});
|
|
79
90
|
const token = freshToken.accessToken;
|
|
80
91
|
return {
|
|
81
92
|
client: new crowdin_api_client_1.default({
|
|
82
93
|
token,
|
|
83
94
|
organization,
|
|
84
|
-
apiDomain: (
|
|
85
|
-
baseUrl: (
|
|
95
|
+
apiDomain: (_d = config.crowdinUrls) === null || _d === void 0 ? void 0 : _d.apiDomain,
|
|
96
|
+
baseUrl: (_e = config.crowdinUrls) === null || _e === void 0 ? void 0 : _e.apiUrl,
|
|
86
97
|
}, { userAgent }),
|
|
87
98
|
token,
|
|
88
99
|
};
|
|
@@ -103,8 +114,8 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
103
114
|
client: new crowdin_api_client_1.default({
|
|
104
115
|
token,
|
|
105
116
|
organization,
|
|
106
|
-
apiDomain: (
|
|
107
|
-
baseUrl: (
|
|
117
|
+
apiDomain: (_f = config.crowdinUrls) === null || _f === void 0 ? void 0 : _f.apiDomain,
|
|
118
|
+
baseUrl: (_g = config.crowdinUrls) === null || _g === void 0 ? void 0 : _g.apiUrl,
|
|
108
119
|
}, { userAgent }),
|
|
109
120
|
token,
|
|
110
121
|
};
|
|
@@ -135,8 +146,8 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
135
146
|
client: new crowdin_api_client_1.default({
|
|
136
147
|
token,
|
|
137
148
|
organization,
|
|
138
|
-
apiDomain: (
|
|
139
|
-
baseUrl: (
|
|
149
|
+
apiDomain: (_h = config.crowdinUrls) === null || _h === void 0 ? void 0 : _h.apiDomain,
|
|
150
|
+
baseUrl: (_j = config.crowdinUrls) === null || _j === void 0 ? void 0 : _j.apiUrl,
|
|
140
151
|
}, {
|
|
141
152
|
httpClient: {
|
|
142
153
|
get(url, httpConfig) {
|
|
@@ -248,7 +259,6 @@ function prepareCrowdinClient({ config, credentials, autoRenew = false, context,
|
|
|
248
259
|
};
|
|
249
260
|
});
|
|
250
261
|
}
|
|
251
|
-
exports.prepareCrowdinClient = prepareCrowdinClient;
|
|
252
262
|
function prepareIntegrationCredentials(config, integration, integrationCredentials) {
|
|
253
263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
254
264
|
const credentials = JSON.parse((0, _1.decryptData)(config, integrationCredentials.credentials));
|
|
@@ -259,7 +269,7 @@ function prepareIntegrationCredentials(config, integration, integrationCredentia
|
|
|
259
269
|
if ((oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.refresh) || (integrationLogin === null || integrationLogin === void 0 ? void 0 : integrationLogin.refresh)) {
|
|
260
270
|
const performRefreshTokenRequest = (oauthLogin === null || oauthLogin === void 0 ? void 0 : oauthLogin.performRefreshTokenRequest) || (integrationLogin === null || integrationLogin === void 0 ? void 0 : integrationLogin.performRefreshTokenRequest);
|
|
261
271
|
credentials.tokenProvider = {
|
|
262
|
-
getToken: (
|
|
272
|
+
getToken: (...args_1) => __awaiter(this, [...args_1], void 0, function* (force = false) {
|
|
263
273
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
264
274
|
const { expireIn } = credentials;
|
|
265
275
|
//2 min as an extra buffer
|
|
@@ -312,9 +322,8 @@ function prepareIntegrationCredentials(config, integration, integrationCredentia
|
|
|
312
322
|
return credentials;
|
|
313
323
|
});
|
|
314
324
|
}
|
|
315
|
-
|
|
316
|
-
function
|
|
317
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
function refreshCrowdinCreds(_a) {
|
|
326
|
+
return __awaiter(this, arguments, void 0, function* ({ config, credentials }) {
|
|
318
327
|
(0, logger_1.log)('Crowdin credentials have expired. Requesting a new credentials');
|
|
319
328
|
const newCredentials = yield refreshToken(config, credentials);
|
|
320
329
|
(0, logger_1.log)('Saving updated crowdin credentials in the database');
|
|
@@ -340,8 +349,8 @@ function refreshCrowdinCreds({ config, credentials }) {
|
|
|
340
349
|
});
|
|
341
350
|
}
|
|
342
351
|
function refreshToken(config, credentials) {
|
|
343
|
-
var _a, _b, _c;
|
|
344
352
|
return __awaiter(this, void 0, void 0, function* () {
|
|
353
|
+
var _a, _b, _c;
|
|
345
354
|
if (config.authenticationType === types_1.AuthenticationType.CODE) {
|
|
346
355
|
const token = yield (0, crowdin_apps_functions_1.refreshOAuthToken)({
|
|
347
356
|
clientId: config.clientId,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
1
|
import { Request, Response } from 'express';
|
|
3
2
|
import { CrowdinClientRequest, UiModule } from '../types';
|
|
4
3
|
declare function maskKey(key: string): string;
|
|
@@ -10,5 +9,5 @@ declare function postRequestCredentialsMasker({ secret, moduleConfig, credential
|
|
|
10
9
|
secret: string;
|
|
11
10
|
moduleConfig: UiModule;
|
|
12
11
|
credentialsExtractor?: Function;
|
|
13
|
-
}): (req: Request
|
|
12
|
+
}): (req: Request | CrowdinClientRequest, res: Response, next: Function) => void;
|
|
14
13
|
export { getRequestCredentialsMasker, maskKey, postRequestCredentialsMasker };
|
|
@@ -9,7 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.getRequestCredentialsMasker = getRequestCredentialsMasker;
|
|
13
|
+
exports.maskKey = maskKey;
|
|
14
|
+
exports.postRequestCredentialsMasker = postRequestCredentialsMasker;
|
|
13
15
|
const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
14
16
|
const index_1 = require("../index");
|
|
15
17
|
const crowdin_client_1 = require("../middlewares/crowdin-client");
|
|
@@ -20,7 +22,6 @@ function maskKey(key) {
|
|
|
20
22
|
const repeatCount = key.length > unmaskedCharsAtEnd ? key.length - unmaskedCharsAtEnd : 0;
|
|
21
23
|
return maskWith.repeat(repeatCount) + key.substring(key.length - 3);
|
|
22
24
|
}
|
|
23
|
-
exports.maskKey = maskKey;
|
|
24
25
|
function getMaskableFieldsKeys(moduleConfig) {
|
|
25
26
|
if (!moduleConfig.formUiSchema) {
|
|
26
27
|
return [];
|
|
@@ -61,7 +62,6 @@ function getRequestCredentialsMasker({ moduleConfig, dataPath = 'formData', }) {
|
|
|
61
62
|
return next();
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
exports.getRequestCredentialsMasker = getRequestCredentialsMasker;
|
|
65
65
|
function postRequestCredentialsMasker({ secret, moduleConfig, credentialsExtractor, }) {
|
|
66
66
|
return (0, index_2.runAsyncWrapper)((req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
|
67
67
|
var _a;
|
|
@@ -101,4 +101,3 @@ function postRequestCredentialsMasker({ secret, moduleConfig, credentialsExtract
|
|
|
101
101
|
return getRequestCredentialsMasker({ moduleConfig })(req, res, next);
|
|
102
102
|
}));
|
|
103
103
|
}
|
|
104
|
-
exports.postRequestCredentialsMasker = postRequestCredentialsMasker;
|
package/out/util/cron.js
CHANGED
|
@@ -15,15 +15,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
36
|
+
exports.NodeCron = void 0;
|
|
37
|
+
exports.initialize = initialize;
|
|
38
|
+
exports.getCron = getCron;
|
|
27
39
|
const logger_1 = require("./logger");
|
|
28
40
|
/**
|
|
29
41
|
* Default Node.js cron handler that uses node-cron
|
|
@@ -73,7 +85,6 @@ function initialize(config) {
|
|
|
73
85
|
cron = new NodeCron();
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
|
-
exports.initialize = initialize;
|
|
77
88
|
/**
|
|
78
89
|
* Get the initialized cron instance
|
|
79
90
|
* @returns The cron instance
|
|
@@ -84,4 +95,3 @@ function getCron() {
|
|
|
84
95
|
}
|
|
85
96
|
return cron;
|
|
86
97
|
}
|
|
87
|
-
exports.getCron = getCron;
|
package/out/util/form-schema.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getLowCodeUiConfigFromModuleConfig = getLowCodeUiConfigFromModuleConfig;
|
|
4
|
+
exports.hasFormSchema = hasFormSchema;
|
|
4
5
|
function getLowCodeUiConfigFromModuleConfig(moduleConfig) {
|
|
5
6
|
var _a;
|
|
6
7
|
if (typeof moduleConfig !== 'object' || moduleConfig === null) {
|
|
@@ -14,8 +15,6 @@ function getLowCodeUiConfigFromModuleConfig(moduleConfig) {
|
|
|
14
15
|
}
|
|
15
16
|
return null;
|
|
16
17
|
}
|
|
17
|
-
exports.getLowCodeUiConfigFromModuleConfig = getLowCodeUiConfigFromModuleConfig;
|
|
18
18
|
function hasFormSchema(moduleConfig) {
|
|
19
19
|
return !!getLowCodeUiConfigFromModuleConfig(moduleConfig);
|
|
20
20
|
}
|
|
21
|
-
exports.hasFormSchema = hasFormSchema;
|
package/out/util/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,7 +42,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
45
|
+
exports.CodeError = void 0;
|
|
46
|
+
exports.extractBaseUrlFromRequest = extractBaseUrlFromRequest;
|
|
47
|
+
exports.runAsyncWrapper = runAsyncWrapper;
|
|
48
|
+
exports.encryptData = encryptData;
|
|
49
|
+
exports.decryptData = decryptData;
|
|
50
|
+
exports.executeWithRetry = executeWithRetry;
|
|
51
|
+
exports.getLogoUrl = getLogoUrl;
|
|
52
|
+
exports.serveLogo = serveLogo;
|
|
53
|
+
exports.isAuthorizedConfig = isAuthorizedConfig;
|
|
54
|
+
exports.isJson = isJson;
|
|
55
|
+
exports.isDefined = isDefined;
|
|
56
|
+
exports.isString = isString;
|
|
57
|
+
exports.getPreviousDate = getPreviousDate;
|
|
58
|
+
exports.prepareFormDataMetadataId = prepareFormDataMetadataId;
|
|
59
|
+
exports.validateEmail = validateEmail;
|
|
60
|
+
exports.getFormattedDate = getFormattedDate;
|
|
61
|
+
exports.kebabCase = kebabCase;
|
|
62
|
+
exports.snakeCase = snakeCase;
|
|
63
|
+
exports.uniqBy = uniqBy;
|
|
36
64
|
const crowdin_apps_functions_1 = require("@crowdin/crowdin-apps-functions");
|
|
37
65
|
const crypto = __importStar(require("crypto"));
|
|
38
66
|
const storage_1 = require("../storage");
|
|
@@ -60,7 +88,6 @@ function extractBaseUrlFromRequest(req) {
|
|
|
60
88
|
const host = req.get('host');
|
|
61
89
|
return `${protocol}://${host}`;
|
|
62
90
|
}
|
|
63
|
-
exports.extractBaseUrlFromRequest = extractBaseUrlFromRequest;
|
|
64
91
|
function isCrowdinClientRequest(req) {
|
|
65
92
|
return req.crowdinContext;
|
|
66
93
|
}
|
|
@@ -100,7 +127,6 @@ function runAsyncWrapper(callback) {
|
|
|
100
127
|
});
|
|
101
128
|
};
|
|
102
129
|
}
|
|
103
|
-
exports.runAsyncWrapper = runAsyncWrapper;
|
|
104
130
|
function encryptData(config, data) {
|
|
105
131
|
const secret = config.cryptoSecret || config.clientSecret;
|
|
106
132
|
const salt = crypto.randomBytes(8);
|
|
@@ -117,7 +143,6 @@ function encryptData(config, data) {
|
|
|
117
143
|
const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
|
|
118
144
|
return Buffer.concat([Buffer.from('Salted__', 'utf8'), salt, cipher.update(data), cipher.final()]).toString('base64');
|
|
119
145
|
}
|
|
120
|
-
exports.encryptData = encryptData;
|
|
121
146
|
function decryptData(config, data) {
|
|
122
147
|
const secret = config.cryptoSecret || config.clientSecret;
|
|
123
148
|
const cypher = Buffer.from(data, 'base64');
|
|
@@ -135,9 +160,8 @@ function decryptData(config, data) {
|
|
|
135
160
|
const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
|
|
136
161
|
return decipher.update(contents, undefined, 'utf-8') + decipher.final('utf-8');
|
|
137
162
|
}
|
|
138
|
-
|
|
139
|
-
function
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
function executeWithRetry(func_1) {
|
|
164
|
+
return __awaiter(this, arguments, void 0, function* (func, numOfRetries = 2) {
|
|
141
165
|
for (let i = 0; i <= numOfRetries; i++) {
|
|
142
166
|
try {
|
|
143
167
|
const result = yield func();
|
|
@@ -152,7 +176,6 @@ function executeWithRetry(func, numOfRetries = 2) {
|
|
|
152
176
|
throw new Error('Failed to process request with retry');
|
|
153
177
|
});
|
|
154
178
|
}
|
|
155
|
-
exports.executeWithRetry = executeWithRetry;
|
|
156
179
|
function getLogoUrl(config, moduleConfig, modulePath) {
|
|
157
180
|
// Extract file name from imagePath with fallback to config.imagePath
|
|
158
181
|
const imagePath = (moduleConfig === null || moduleConfig === void 0 ? void 0 : moduleConfig.imagePath) || config.imagePath;
|
|
@@ -162,7 +185,6 @@ function getLogoUrl(config, moduleConfig, modulePath) {
|
|
|
162
185
|
}
|
|
163
186
|
return `/logo${modulePath}/${fileName}`;
|
|
164
187
|
}
|
|
165
|
-
exports.getLogoUrl = getLogoUrl;
|
|
166
188
|
/**
|
|
167
189
|
* Logo middleware with backwards compatibility
|
|
168
190
|
* Serves both /logo.png (backwards-compatible) and actual file name
|
|
@@ -182,11 +204,9 @@ function serveLogo(config, moduleConfig) {
|
|
|
182
204
|
next();
|
|
183
205
|
});
|
|
184
206
|
}
|
|
185
|
-
exports.serveLogo = serveLogo;
|
|
186
207
|
function isAuthorizedConfig(config) {
|
|
187
208
|
return !!config.clientId && !!config.clientSecret && config.authenticationType !== types_1.AuthenticationType.NONE;
|
|
188
209
|
}
|
|
189
|
-
exports.isAuthorizedConfig = isAuthorizedConfig;
|
|
190
210
|
function isJson(string) {
|
|
191
211
|
try {
|
|
192
212
|
JSON.parse(string);
|
|
@@ -196,21 +216,17 @@ function isJson(string) {
|
|
|
196
216
|
}
|
|
197
217
|
return true;
|
|
198
218
|
}
|
|
199
|
-
exports.isJson = isJson;
|
|
200
219
|
function isDefined(value) {
|
|
201
220
|
return value !== undefined && value !== null;
|
|
202
221
|
}
|
|
203
|
-
exports.isDefined = isDefined;
|
|
204
222
|
function isString(value) {
|
|
205
223
|
return typeof value === 'string' || value instanceof String;
|
|
206
224
|
}
|
|
207
|
-
exports.isString = isString;
|
|
208
225
|
function getPreviousDate(days) {
|
|
209
226
|
const date = new Date();
|
|
210
227
|
date.setDate(date.getDate() - days);
|
|
211
228
|
return date;
|
|
212
229
|
}
|
|
213
|
-
exports.getPreviousDate = getPreviousDate;
|
|
214
230
|
function prepareFormDataMetadataId(req, config) {
|
|
215
231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
216
232
|
const jwtToken = req.query.jwtToken;
|
|
@@ -226,7 +242,6 @@ function prepareFormDataMetadataId(req, config) {
|
|
|
226
242
|
return id.join('-');
|
|
227
243
|
});
|
|
228
244
|
}
|
|
229
|
-
exports.prepareFormDataMetadataId = prepareFormDataMetadataId;
|
|
230
245
|
function validateEmail(email) {
|
|
231
246
|
if (!isNaN(+email)) {
|
|
232
247
|
return false;
|
|
@@ -237,7 +252,6 @@ function validateEmail(email) {
|
|
|
237
252
|
const emailRegExp = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
238
253
|
return emailRegExp.test(String(email).toLowerCase());
|
|
239
254
|
}
|
|
240
|
-
exports.validateEmail = validateEmail;
|
|
241
255
|
// Format the date as 'MMM DD, YYYY HH:mm'
|
|
242
256
|
function getFormattedDate({ date, userTimezone }) {
|
|
243
257
|
if (!userTimezone) {
|
|
@@ -253,7 +267,6 @@ function getFormattedDate({ date, userTimezone }) {
|
|
|
253
267
|
timeZone: userTimezone,
|
|
254
268
|
}).format(date);
|
|
255
269
|
}
|
|
256
|
-
exports.getFormattedDate = getFormattedDate;
|
|
257
270
|
function kebabCase(str) {
|
|
258
271
|
if (!str) {
|
|
259
272
|
return '';
|
|
@@ -271,11 +284,9 @@ function kebabCase(str) {
|
|
|
271
284
|
// Lowercase everything
|
|
272
285
|
.toLowerCase());
|
|
273
286
|
}
|
|
274
|
-
exports.kebabCase = kebabCase;
|
|
275
287
|
function snakeCase(str) {
|
|
276
288
|
return kebabCase(str).replace(/-/g, '_');
|
|
277
289
|
}
|
|
278
|
-
exports.snakeCase = snakeCase;
|
|
279
290
|
function uniqBy(array, key) {
|
|
280
291
|
if (!Array.isArray(array)) {
|
|
281
292
|
return [];
|
|
@@ -292,4 +303,3 @@ function uniqBy(array, key) {
|
|
|
292
303
|
}
|
|
293
304
|
});
|
|
294
305
|
}
|
|
295
|
-
exports.uniqBy = uniqBy;
|
package/out/util/jsx-renderer.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.renderJSXOnServer = renderJSXOnServer;
|
|
4
|
+
exports.renderJSXOnClient = renderJSXOnClient;
|
|
4
5
|
const server_1 = require("react-dom/server");
|
|
5
6
|
const views_1 = require("../views");
|
|
6
7
|
/**
|
|
@@ -11,7 +12,6 @@ function renderJSXOnServer(Component, props) {
|
|
|
11
12
|
const element = Component(props);
|
|
12
13
|
return '<!DOCTYPE html>' + (0, server_1.renderToStaticMarkup)(element);
|
|
13
14
|
}
|
|
14
|
-
exports.renderJSXOnServer = renderJSXOnServer;
|
|
15
15
|
/**
|
|
16
16
|
* Renders a React component to HTML string to be hydrated on client side
|
|
17
17
|
*/
|
|
@@ -32,4 +32,3 @@ function renderJSXOnClient({ name, props, withHead = true, }) {
|
|
|
32
32
|
</html>
|
|
33
33
|
`;
|
|
34
34
|
}
|
|
35
|
-
exports.renderJSXOnClient = renderJSXOnClient;
|
package/out/util/logger.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,7 +42,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
42
|
});
|
|
33
43
|
};
|
|
34
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
45
|
+
exports.AppModuleAggregateError = exports.AppUserModuleError = exports.AppModuleError = void 0;
|
|
46
|
+
exports.initialize = initialize;
|
|
47
|
+
exports.prepareContext = prepareContext;
|
|
48
|
+
exports.withContext = withContext;
|
|
49
|
+
exports.withContextError = withContextError;
|
|
50
|
+
exports.log = log;
|
|
51
|
+
exports.logError = logError;
|
|
52
|
+
exports.isAxiosError = isAxiosError;
|
|
53
|
+
exports.isInternalErrorMessage = isInternalErrorMessage;
|
|
54
|
+
exports.getErrorMessage = getErrorMessage;
|
|
55
|
+
exports.handleUserError = handleUserError;
|
|
56
|
+
exports.temporaryErrorDebug = temporaryErrorDebug;
|
|
36
57
|
const logsFormatter = __importStar(require("@crowdin/logs-formatter"));
|
|
37
58
|
const storage_1 = require("../storage");
|
|
38
59
|
let logConfig;
|
|
@@ -41,7 +62,6 @@ function initialize(config) {
|
|
|
41
62
|
logConfig = config.logger;
|
|
42
63
|
onError = config.onError;
|
|
43
64
|
}
|
|
44
|
-
exports.initialize = initialize;
|
|
45
65
|
function prepareContext(context) {
|
|
46
66
|
return {
|
|
47
67
|
orgId: context.crowdinId,
|
|
@@ -49,15 +69,12 @@ function prepareContext(context) {
|
|
|
49
69
|
projectId: context.jwtPayload.context.project_id,
|
|
50
70
|
};
|
|
51
71
|
}
|
|
52
|
-
exports.prepareContext = prepareContext;
|
|
53
72
|
function withContext(context) {
|
|
54
73
|
return (message) => log(message, context);
|
|
55
74
|
}
|
|
56
|
-
exports.withContext = withContext;
|
|
57
75
|
function withContextError(context) {
|
|
58
76
|
return (e) => logError(e, context);
|
|
59
77
|
}
|
|
60
|
-
exports.withContextError = withContextError;
|
|
61
78
|
function log(message, context) {
|
|
62
79
|
var _a, _b, _c;
|
|
63
80
|
if (logConfig === null || logConfig === void 0 ? void 0 : logConfig.enabled) {
|
|
@@ -92,7 +109,6 @@ function log(message, context) {
|
|
|
92
109
|
}
|
|
93
110
|
}
|
|
94
111
|
}
|
|
95
|
-
exports.log = log;
|
|
96
112
|
function logError(e, context) {
|
|
97
113
|
var _a, _b, _c;
|
|
98
114
|
if (onError) {
|
|
@@ -131,7 +147,6 @@ function logError(e, context) {
|
|
|
131
147
|
}
|
|
132
148
|
}
|
|
133
149
|
}
|
|
134
|
-
exports.logError = logError;
|
|
135
150
|
function errorOutputByType(error) {
|
|
136
151
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
137
152
|
if (error instanceof AppUserModuleError) {
|
|
@@ -161,7 +176,6 @@ function errorOutputByType(error) {
|
|
|
161
176
|
function isAxiosError(e) {
|
|
162
177
|
return !!e.isAxiosError;
|
|
163
178
|
}
|
|
164
|
-
exports.isAxiosError = isAxiosError;
|
|
165
179
|
function isInternalErrorMessage(message) {
|
|
166
180
|
const internalErrorMessagePrefixes = ['SQL'];
|
|
167
181
|
for (const prefix of internalErrorMessagePrefixes) {
|
|
@@ -171,7 +185,6 @@ function isInternalErrorMessage(message) {
|
|
|
171
185
|
}
|
|
172
186
|
return false;
|
|
173
187
|
}
|
|
174
|
-
exports.isInternalErrorMessage = isInternalErrorMessage;
|
|
175
188
|
function getErrorMessage(err) {
|
|
176
189
|
let message = 'Internal Server Error';
|
|
177
190
|
if (typeof err === 'string') {
|
|
@@ -182,7 +195,6 @@ function getErrorMessage(err) {
|
|
|
182
195
|
}
|
|
183
196
|
return isInternalErrorMessage(message) ? 'Internal Server Error' : message;
|
|
184
197
|
}
|
|
185
|
-
exports.getErrorMessage = getErrorMessage;
|
|
186
198
|
class AppModuleError extends Error {
|
|
187
199
|
constructor(error, data) {
|
|
188
200
|
super(typeof error === 'string' ? error : error.message);
|
|
@@ -216,21 +228,21 @@ class AppModuleAggregateError extends Error {
|
|
|
216
228
|
}
|
|
217
229
|
}
|
|
218
230
|
exports.AppModuleAggregateError = AppModuleAggregateError;
|
|
219
|
-
function storeUserError(
|
|
220
|
-
|
|
221
|
-
|
|
231
|
+
function storeUserError(_a) {
|
|
232
|
+
return __awaiter(this, arguments, void 0, function* ({ action, error, crowdinId, clientId, }) {
|
|
233
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
222
234
|
const data = {};
|
|
223
235
|
if (isAxiosError(error)) {
|
|
224
236
|
data.requestParams = {
|
|
225
|
-
method: ((
|
|
226
|
-
protocol: ((
|
|
227
|
-
host: ((
|
|
228
|
-
path: ((
|
|
237
|
+
method: ((_b = error === null || error === void 0 ? void 0 : error.request) === null || _b === void 0 ? void 0 : _b.method) || ((_d = (_c = error === null || error === void 0 ? void 0 : error.data) === null || _c === void 0 ? void 0 : _c.request) === null || _d === void 0 ? void 0 : _d.method),
|
|
238
|
+
protocol: ((_e = error === null || error === void 0 ? void 0 : error.request) === null || _e === void 0 ? void 0 : _e.protocol) || ((_g = (_f = error === null || error === void 0 ? void 0 : error.data) === null || _f === void 0 ? void 0 : _f.request) === null || _g === void 0 ? void 0 : _g.protocol),
|
|
239
|
+
host: ((_h = error === null || error === void 0 ? void 0 : error.request) === null || _h === void 0 ? void 0 : _h.host) || ((_k = (_j = error === null || error === void 0 ? void 0 : error.data) === null || _j === void 0 ? void 0 : _j.request) === null || _k === void 0 ? void 0 : _k.host),
|
|
240
|
+
path: ((_l = error === null || error === void 0 ? void 0 : error.request) === null || _l === void 0 ? void 0 : _l.path) || ((_o = (_m = error === null || error === void 0 ? void 0 : error.data) === null || _m === void 0 ? void 0 : _m.request) === null || _o === void 0 ? void 0 : _o.path),
|
|
229
241
|
};
|
|
230
242
|
data.responseData = {
|
|
231
|
-
data: ((
|
|
232
|
-
status: ((
|
|
233
|
-
statusText: ((
|
|
243
|
+
data: ((_p = error === null || error === void 0 ? void 0 : error.response) === null || _p === void 0 ? void 0 : _p.data) || ((_r = (_q = error === null || error === void 0 ? void 0 : error.data) === null || _q === void 0 ? void 0 : _q.response) === null || _r === void 0 ? void 0 : _r.data),
|
|
244
|
+
status: ((_s = error === null || error === void 0 ? void 0 : error.response) === null || _s === void 0 ? void 0 : _s.status) || ((_u = (_t = error === null || error === void 0 ? void 0 : error.data) === null || _t === void 0 ? void 0 : _t.response) === null || _u === void 0 ? void 0 : _u.status),
|
|
245
|
+
statusText: ((_v = error === null || error === void 0 ? void 0 : error.response) === null || _v === void 0 ? void 0 : _v.statusText) || ((_x = (_w = error === null || error === void 0 ? void 0 : error.data) === null || _w === void 0 ? void 0 : _w.response) === null || _x === void 0 ? void 0 : _x.statusText),
|
|
234
246
|
};
|
|
235
247
|
}
|
|
236
248
|
if ((error instanceof AppModuleError || error instanceof AppUserModuleError) && error.appData) {
|
|
@@ -272,8 +284,8 @@ function mergeAppModuleAggregateErrors(errors) {
|
|
|
272
284
|
}
|
|
273
285
|
return result;
|
|
274
286
|
}
|
|
275
|
-
function handleUserError(
|
|
276
|
-
return __awaiter(this,
|
|
287
|
+
function handleUserError(_a) {
|
|
288
|
+
return __awaiter(this, arguments, void 0, function* ({ action, error, crowdinId, clientId, }) {
|
|
277
289
|
if (typeof error === 'string') {
|
|
278
290
|
return;
|
|
279
291
|
}
|
|
@@ -288,9 +300,7 @@ function handleUserError({ action, error, crowdinId, clientId, }) {
|
|
|
288
300
|
}
|
|
289
301
|
});
|
|
290
302
|
}
|
|
291
|
-
exports.handleUserError = handleUserError;
|
|
292
303
|
function temporaryErrorDebug(msg, req) {
|
|
293
304
|
// eslint-disable-next-line no-console
|
|
294
305
|
console.log(msg, req.headers, Object.assign({ originalUrl: req.originalUrl }, req.query));
|
|
295
306
|
}
|
|
296
|
-
exports.temporaryErrorDebug = temporaryErrorDebug;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Static Files Abstraction Layer
|
|
3
3
|
* Dual compatibility: Node.js (Express) + Cloudflare Workers (Assets Fetcher)
|
|
4
4
|
*/
|
|
5
|
-
/// <reference types="serve-static" />
|
|
6
5
|
import express, { Request, Response } from 'express';
|
|
7
6
|
import { Config, UnauthorizedConfig } from '../types';
|
|
8
7
|
/**
|
package/out/util/static-files.js
CHANGED
|
@@ -16,7 +16,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.serveStatic = serveStatic;
|
|
20
|
+
exports.serveFile = serveFile;
|
|
20
21
|
const express_1 = __importDefault(require("express"));
|
|
21
22
|
const path_1 = __importDefault(require("path"));
|
|
22
23
|
/**
|
|
@@ -63,7 +64,6 @@ function serveStatic(config, staticPath) {
|
|
|
63
64
|
const absolutePath = path_1.default.isAbsolute(staticPath) ? staticPath : path_1.default.join(rootDir, staticPath);
|
|
64
65
|
return express_1.default.static(absolutePath);
|
|
65
66
|
}
|
|
66
|
-
exports.serveStatic = serveStatic;
|
|
67
67
|
/**
|
|
68
68
|
* Serve single file (e.g., logo.png, icons/star.svg) with dual compatibility
|
|
69
69
|
* @param config - App configuration
|
|
@@ -84,4 +84,3 @@ function serveFile(config, filePath) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
exports.serveFile = serveFile;
|