@crowdin/app-project-module 1.2.1 → 1.3.1
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.d.ts +1 -1
- package/out/storage/d1.js +29 -27
- package/out/storage/index.d.ts +1 -1
- package/out/storage/index.js +25 -11
- package/out/storage/mysql.d.ts +1 -1
- package/out/storage/mysql.js +35 -33
- package/out/storage/postgre.d.ts +1 -1
- package/out/storage/postgre.js +46 -44
- package/out/storage/sqlite.d.ts +1 -1
- package/out/storage/sqlite.js +18 -16
- 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/storage/sqlite.js
CHANGED
|
@@ -122,17 +122,19 @@ class SQLiteStorage {
|
|
|
122
122
|
};
|
|
123
123
|
this.config = config;
|
|
124
124
|
}
|
|
125
|
-
migrate() {
|
|
125
|
+
migrate(skipOnboarding) {
|
|
126
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
127
|
this.db = require('better-sqlite3')((0, path_1.join)(this.config.dbFolder, types_2.storageFiles.SQLITE));
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
if (!skipOnboarding) {
|
|
129
|
+
try {
|
|
130
|
+
for (const [tableName, schema] of Object.entries(this.tables)) {
|
|
131
|
+
this.db.prepare(`CREATE TABLE IF NOT EXISTS ${tableName} ${schema}`).run();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.error('Error during database migration:', error);
|
|
136
|
+
throw error;
|
|
131
137
|
}
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
console.error('Error during database migration:', error);
|
|
135
|
-
throw error;
|
|
136
138
|
}
|
|
137
139
|
});
|
|
138
140
|
}
|
|
@@ -516,8 +518,8 @@ class SQLiteStorage {
|
|
|
516
518
|
return id;
|
|
517
519
|
});
|
|
518
520
|
}
|
|
519
|
-
updateJob(
|
|
520
|
-
return __awaiter(this,
|
|
521
|
+
updateJob(_a) {
|
|
522
|
+
return __awaiter(this, arguments, void 0, function* ({ id, progress, status, info, data, attempt, errors, processedEntities, }) {
|
|
521
523
|
const updateFields = ['updated_at = ?'];
|
|
522
524
|
const updateParams = [Date.now().toString()];
|
|
523
525
|
if (progress) {
|
|
@@ -598,8 +600,8 @@ class SQLiteStorage {
|
|
|
598
600
|
`).all(types_1.JobStatus.IN_PROGRESS, types_1.JobStatus.CREATED);
|
|
599
601
|
});
|
|
600
602
|
}
|
|
601
|
-
getAllJobs(
|
|
602
|
-
return __awaiter(this,
|
|
603
|
+
getAllJobs(_a) {
|
|
604
|
+
return __awaiter(this, arguments, void 0, function* ({ integrationId, crowdinId, limit, offset }) {
|
|
603
605
|
return this.db.prepare(`
|
|
604
606
|
SELECT
|
|
605
607
|
id,
|
|
@@ -624,8 +626,8 @@ class SQLiteStorage {
|
|
|
624
626
|
});
|
|
625
627
|
}
|
|
626
628
|
saveTranslationCache(params) {
|
|
627
|
-
var _a;
|
|
628
629
|
return __awaiter(this, void 0, void 0, function* () {
|
|
630
|
+
var _a;
|
|
629
631
|
this.db.prepare(`
|
|
630
632
|
INSERT INTO translation_file_cache
|
|
631
633
|
(integration_id, crowdin_id, file_id, language_id, etag)
|
|
@@ -709,9 +711,9 @@ class SQLiteStorage {
|
|
|
709
711
|
this.db.prepare(insertQuery).run(...values);
|
|
710
712
|
});
|
|
711
713
|
}
|
|
712
|
-
selectRecords(
|
|
713
|
-
|
|
714
|
-
|
|
714
|
+
selectRecords(tableName_1) {
|
|
715
|
+
return __awaiter(this, arguments, void 0, function* (tableName, options = {}, params) {
|
|
716
|
+
var _a;
|
|
715
717
|
const columns = ((_a = options.columns) === null || _a === void 0 ? void 0 : _a.length) ? options.columns.join(', ') : '*';
|
|
716
718
|
const distinctKeyword = options.distinct ? 'DISTINCT ' : '';
|
|
717
719
|
const whereClause = options.whereClause ? ` ${options.whereClause}` : '';
|
package/out/types.d.ts
CHANGED
package/out/types.js
CHANGED
|
@@ -8,7 +8,7 @@ var AuthenticationType;
|
|
|
8
8
|
AuthenticationType["APP_WITH_CODE"] = "crowdin_app_with_code";
|
|
9
9
|
AuthenticationType["AGENT"] = "crowdin_agent";
|
|
10
10
|
AuthenticationType["NONE"] = "none";
|
|
11
|
-
})(AuthenticationType
|
|
11
|
+
})(AuthenticationType || (exports.AuthenticationType = AuthenticationType = {}));
|
|
12
12
|
var Scope;
|
|
13
13
|
(function (Scope) {
|
|
14
14
|
Scope["ALL_SCOPES"] = "all";
|
|
@@ -36,17 +36,17 @@ var Scope;
|
|
|
36
36
|
Scope["AI_PROMPTS"] = "ai.prompt";
|
|
37
37
|
Scope["AI_PROXIES"] = "ai.proxy";
|
|
38
38
|
Scope["APPLICATIONS"] = "application";
|
|
39
|
-
})(Scope
|
|
39
|
+
})(Scope || (exports.Scope = Scope = {}));
|
|
40
40
|
var AccountType;
|
|
41
41
|
(function (AccountType) {
|
|
42
42
|
AccountType["NORMAL"] = "normal";
|
|
43
43
|
AccountType["ENTERPRISE"] = "enterprise";
|
|
44
|
-
})(AccountType
|
|
44
|
+
})(AccountType || (exports.AccountType = AccountType = {}));
|
|
45
45
|
var SubscriptionInfoType;
|
|
46
46
|
(function (SubscriptionInfoType) {
|
|
47
47
|
SubscriptionInfoType["TRIAL"] = "trial";
|
|
48
48
|
SubscriptionInfoType["SUBSCRIPTION"] = "subscription";
|
|
49
|
-
})(SubscriptionInfoType
|
|
49
|
+
})(SubscriptionInfoType || (exports.SubscriptionInfoType = SubscriptionInfoType = {}));
|
|
50
50
|
var EditorMode;
|
|
51
51
|
(function (EditorMode) {
|
|
52
52
|
EditorMode["ASSETS"] = "assets";
|
|
@@ -56,7 +56,7 @@ var EditorMode;
|
|
|
56
56
|
EditorMode["COMFORTABLE"] = "comfortable";
|
|
57
57
|
EditorMode["SIDE_BY_SIDE"] = "side-by-side";
|
|
58
58
|
EditorMode["MULTILINGUAL"] = "multilingual";
|
|
59
|
-
})(EditorMode
|
|
59
|
+
})(EditorMode || (exports.EditorMode = EditorMode = {}));
|
|
60
60
|
var UserPermissions;
|
|
61
61
|
(function (UserPermissions) {
|
|
62
62
|
UserPermissions["OWNER"] = "owner";
|
|
@@ -64,15 +64,15 @@ var UserPermissions;
|
|
|
64
64
|
UserPermissions["ALL_MEMBERS"] = "all";
|
|
65
65
|
UserPermissions["GUESTS"] = "guests";
|
|
66
66
|
UserPermissions["RESTRICTED"] = "restricted";
|
|
67
|
-
})(UserPermissions
|
|
67
|
+
})(UserPermissions || (exports.UserPermissions = UserPermissions = {}));
|
|
68
68
|
var ProjectPermissions;
|
|
69
69
|
(function (ProjectPermissions) {
|
|
70
70
|
ProjectPermissions["OWN"] = "own";
|
|
71
71
|
ProjectPermissions["RESTRICTED"] = "restricted";
|
|
72
|
-
})(ProjectPermissions
|
|
72
|
+
})(ProjectPermissions || (exports.ProjectPermissions = ProjectPermissions = {}));
|
|
73
73
|
var storageFiles;
|
|
74
74
|
(function (storageFiles) {
|
|
75
75
|
storageFiles["SQLITE"] = "app.sqlite";
|
|
76
76
|
storageFiles["SQLITE_BACKUP"] = "backup_app.sqlite";
|
|
77
77
|
storageFiles["DUMP"] = "dump_table_%s.sql";
|
|
78
|
-
})(storageFiles
|
|
78
|
+
})(storageFiles || (exports.storageFiles = storageFiles = {}));
|
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;
|