@crowdin/app-project-module 0.44.0 → 0.45.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.
Files changed (149) hide show
  1. package/out/index.d.ts +3 -3
  2. package/out/index.js +52 -59
  3. package/out/middlewares/crowdin-client.d.ts +1 -1
  4. package/out/middlewares/crowdin-client.js +3 -2
  5. package/out/middlewares/integration-credentials.d.ts +2 -2
  6. package/out/middlewares/render-ui-module.d.ts +2 -2
  7. package/out/middlewares/ui-module.d.ts +2 -2
  8. package/out/middlewares/ui-module.js +3 -3
  9. package/out/{util → modules}/api/api.d.ts +2 -1
  10. package/out/{util → modules}/api/api.js +22 -22
  11. package/out/modules/api/index.d.ts +6 -0
  12. package/out/modules/api/index.js +14 -0
  13. package/out/modules/api/types.d.ts +20 -0
  14. package/out/modules/api/types.js +11 -0
  15. package/out/modules/context-menu/index.d.ts +1 -1
  16. package/out/modules/context-menu/index.js +2 -2
  17. package/out/modules/context-menu/types.d.ts +27 -0
  18. package/out/modules/context-menu/types.js +18 -0
  19. package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
  20. package/out/modules/custom-mt/index.d.ts +1 -1
  21. package/out/modules/custom-mt/types.d.ts +1 -1
  22. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
  23. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
  24. package/out/modules/custom-spell-check/index.d.ts +1 -1
  25. package/out/modules/custom-spell-check/index.js +2 -2
  26. package/out/modules/custom-spell-check/types.d.ts +1 -1
  27. package/out/modules/editor-right-panel/index.d.ts +1 -1
  28. package/out/modules/editor-right-panel/index.js +2 -2
  29. package/out/modules/editor-right-panel/types.d.ts +1 -1
  30. package/out/modules/editor-themes/index.d.ts +1 -1
  31. package/out/modules/editor-themes/types.d.ts +17 -0
  32. package/out/modules/editor-themes/types.js +2 -0
  33. package/out/modules/file-processing/handlers/custom-file-format.d.ts +1 -1
  34. package/out/modules/file-processing/handlers/custom-file-format.js +1 -1
  35. package/out/modules/file-processing/handlers/file-download.d.ts +2 -2
  36. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
  37. package/out/modules/file-processing/handlers/pre-post-process.js +1 -1
  38. package/out/modules/file-processing/index.d.ts +1 -1
  39. package/out/modules/file-processing/index.js +1 -1
  40. package/out/modules/file-processing/types.d.ts +1 -1
  41. package/out/modules/file-processing/util/defaults.d.ts +3 -0
  42. package/out/modules/file-processing/util/defaults.js +30 -0
  43. package/out/modules/file-processing/util/files.d.ts +6 -0
  44. package/out/modules/file-processing/util/files.js +47 -0
  45. package/out/modules/form-data-display.d.ts +1 -1
  46. package/out/modules/form-data-save.d.ts +1 -1
  47. package/out/modules/install.d.ts +2 -2
  48. package/out/modules/install.js +3 -3
  49. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
  50. package/out/modules/integration/handlers/crowdin-files.d.ts +2 -2
  51. package/out/modules/integration/handlers/crowdin-files.js +1 -1
  52. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
  53. package/out/modules/integration/handlers/crowdin-update.d.ts +2 -2
  54. package/out/modules/integration/handlers/crowdin-update.js +7 -7
  55. package/out/modules/integration/handlers/crowdin-webhook.d.ts +2 -2
  56. package/out/modules/integration/handlers/crowdin-webhook.js +16 -5
  57. package/out/modules/integration/handlers/integration-data.d.ts +1 -1
  58. package/out/modules/integration/handlers/integration-data.js +2 -2
  59. package/out/modules/integration/handlers/integration-login.d.ts +1 -1
  60. package/out/modules/integration/handlers/integration-logout.d.ts +2 -2
  61. package/out/modules/integration/handlers/integration-logout.js +11 -4
  62. package/out/modules/integration/handlers/integration-update.d.ts +2 -2
  63. package/out/modules/integration/handlers/integration-update.js +7 -6
  64. package/out/modules/integration/handlers/integration-webhook.d.ts +2 -2
  65. package/out/modules/integration/handlers/integration-webhook.js +7 -2
  66. package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
  67. package/out/modules/integration/handlers/job-cancel.js +2 -2
  68. package/out/modules/integration/handlers/job-info.d.ts +1 -1
  69. package/out/modules/integration/handlers/job-info.js +2 -2
  70. package/out/modules/integration/handlers/main.d.ts +2 -2
  71. package/out/modules/integration/handlers/main.js +3 -3
  72. package/out/modules/integration/handlers/oauth-login.d.ts +2 -2
  73. package/out/modules/integration/handlers/oauth-login.js +1 -1
  74. package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
  75. package/out/modules/integration/handlers/oauth-url.js +1 -1
  76. package/out/modules/integration/handlers/settings-save.d.ts +2 -2
  77. package/out/modules/integration/handlers/settings-save.js +25 -8
  78. package/out/modules/integration/handlers/settings.d.ts +1 -1
  79. package/out/modules/integration/handlers/subscription-info.d.ts +1 -1
  80. package/out/modules/integration/handlers/subscription-info.js +2 -2
  81. package/out/modules/integration/handlers/sync-settings-save.d.ts +2 -2
  82. package/out/modules/integration/handlers/sync-settings-save.js +15 -7
  83. package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
  84. package/out/modules/integration/handlers/user-errors.d.ts +1 -1
  85. package/out/modules/integration/index.d.ts +1 -1
  86. package/out/modules/integration/index.js +15 -10
  87. package/out/modules/integration/types.d.ts +2 -13
  88. package/out/modules/integration/util/cron.d.ts +27 -0
  89. package/out/{util → modules/integration/util}/cron.js +92 -23
  90. package/out/{util → modules/integration/util}/defaults.d.ts +2 -6
  91. package/out/{util → modules/integration/util}/defaults.js +1 -46
  92. package/out/modules/integration/util/files.d.ts +5 -0
  93. package/out/{util → modules/integration/util}/files.js +9 -40
  94. package/out/{util → modules/integration/util}/job.d.ts +1 -1
  95. package/out/{util → modules/integration/util}/job.js +11 -11
  96. package/out/{util/file-snapshot.d.ts → modules/integration/util/snapshot.d.ts} +2 -4
  97. package/out/{util/file-snapshot.js → modules/integration/util/snapshot.js} +4 -63
  98. package/out/{models/job.d.ts → modules/integration/util/types.d.ts} +14 -0
  99. package/out/modules/integration/util/webhooks.d.ts +48 -0
  100. package/out/{util → modules/integration/util}/webhooks.js +92 -46
  101. package/out/modules/manifest.d.ts +1 -1
  102. package/out/modules/manifest.js +27 -66
  103. package/out/modules/modal/index.d.ts +1 -1
  104. package/out/modules/modal/index.js +2 -2
  105. package/out/modules/organization-menu/index.d.ts +1 -1
  106. package/out/modules/organization-menu/index.js +1 -2
  107. package/out/modules/profile-resources-menu/index.d.ts +1 -1
  108. package/out/modules/profile-resources-menu/index.js +1 -2
  109. package/out/modules/project-menu/index.d.ts +1 -1
  110. package/out/modules/project-menu/index.js +2 -2
  111. package/out/modules/project-menu-crowdsource/index.d.ts +1 -1
  112. package/out/modules/project-menu-crowdsource/index.js +2 -2
  113. package/out/modules/project-reports/index.d.ts +1 -1
  114. package/out/modules/project-reports/index.js +1 -2
  115. package/out/modules/project-tools/index.d.ts +1 -1
  116. package/out/modules/project-tools/index.js +1 -2
  117. package/out/modules/subscription-paid.d.ts +1 -1
  118. package/out/modules/subscription-paid.js +2 -2
  119. package/out/modules/uninstall.d.ts +2 -2
  120. package/out/modules/uninstall.js +6 -2
  121. package/out/storage/index.d.ts +3 -2
  122. package/out/storage/mysql.d.ts +3 -2
  123. package/out/storage/mysql.js +3 -3
  124. package/out/storage/postgre.d.ts +3 -2
  125. package/out/storage/postgre.js +3 -3
  126. package/out/storage/sqlite.d.ts +3 -2
  127. package/out/storage/sqlite.js +3 -3
  128. package/out/storage/types.d.ts +9 -0
  129. package/out/storage/types.js +2 -0
  130. package/out/{models/index.d.ts → types.d.ts} +16 -84
  131. package/out/{models/index.js → types.js} +1 -24
  132. package/out/util/connection.d.ts +1 -9
  133. package/out/util/connection.js +54 -150
  134. package/out/util/handlebars.d.ts +1 -0
  135. package/out/util/handlebars.js +34 -0
  136. package/out/util/index.d.ts +2 -3
  137. package/out/util/index.js +6 -6
  138. package/out/util/logger.d.ts +1 -1
  139. package/out/util/subscription.d.ts +9 -0
  140. package/out/util/subscription.js +111 -0
  141. package/package.json +1 -1
  142. package/out/util/cron.d.ts +0 -8
  143. package/out/util/files.d.ts +0 -10
  144. package/out/util/webhooks.d.ts +0 -29
  145. /package/out/{util → modules}/api/base.d.ts +0 -0
  146. /package/out/{util → modules}/api/base.js +0 -0
  147. /package/out/{util → modules}/api/components.d.ts +0 -0
  148. /package/out/{util → modules}/api/components.js +0 -0
  149. /package/out/{models/job.js → modules/integration/util/types.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { Express } from 'express';
2
- import { Config, UnauthorizedConfig } from '../../models';
2
+ import { Config, UnauthorizedConfig } from '../../types';
3
3
  export declare function register({ config, app }: {
4
4
  config: Config | UnauthorizedConfig;
5
5
  app: Express;
@@ -7,12 +7,11 @@ exports.register = void 0;
7
7
  const render_ui_module_1 = __importDefault(require("../../middlewares/render-ui-module"));
8
8
  const ui_module_1 = __importDefault(require("../../middlewares/ui-module"));
9
9
  const util_1 = require("../../util");
10
- const defaults_1 = require("../../util/defaults");
11
10
  function register({ config, app }) {
12
11
  if (!config.projectTools) {
13
12
  return;
14
13
  }
15
- const allowUnauthorized = !(0, defaults_1.isAuthorizedConfig)(config);
14
+ const allowUnauthorized = !(0, util_1.isAuthorizedConfig)(config);
16
15
  app.get((0, util_1.getLogoUrl)(config.projectTools, '/tools'), (req, res) => { var _a; return res.sendFile(((_a = config.projectTools) === null || _a === void 0 ? void 0 : _a.imagePath) || config.imagePath); });
17
16
  app.use('/tools', (0, ui_module_1.default)(config, allowUnauthorized), (0, render_ui_module_1.default)(config.projectTools));
18
17
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="qs" />
2
2
  import { Request, Response } from 'express';
3
- export default function handle(): (req: import("../models").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ export default function handle(): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const util_1 = require("../util");
13
- const connection_1 = require("../util/connection");
13
+ const subscription_1 = require("../util/subscription");
14
14
  const logger_1 = require("../util/logger");
15
15
  function handle() {
16
16
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
17
17
  const organizationId = (req.query || {})['organization_id'] || (req.body || {})['organization_id'];
18
18
  (0, logger_1.log)(`Received subscription paid request for organization ${organizationId}`);
19
- (0, connection_1.clearCache)(organizationId);
19
+ (0, subscription_1.clearCache)(organizationId);
20
20
  res.status(204).end();
21
21
  }));
22
22
  }
@@ -1,4 +1,4 @@
1
1
  /// <reference types="qs" />
2
2
  import { Request, Response } from 'express';
3
- import { Config } from '../models';
4
- export default function handle(config: Config): (req: import("../models").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
3
+ import { Config } from '../types';
4
+ export default function handle(config: Config): (req: import("../types").CrowdinClientRequest | Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: Function) => void;
@@ -13,7 +13,7 @@ const storage_1 = require("../storage");
13
13
  const util_1 = require("../util");
14
14
  const connection_1 = require("../util/connection");
15
15
  const logger_1 = require("../util/logger");
16
- const webhooks_1 = require("../util/webhooks");
16
+ const webhooks_1 = require("./integration/util/webhooks");
17
17
  function handle(config) {
18
18
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
19
19
  const event = req.body;
@@ -40,7 +40,11 @@ function handle(config) {
40
40
  }
41
41
  if (projectIntegration) {
42
42
  if (projectIntegration.webhooks) {
43
- yield (0, webhooks_1.unregisterAllCrowdinWebhooks)(config, projectIntegration, organization);
43
+ yield (0, webhooks_1.unregisterAllCrowdinWebhooks)({
44
+ config,
45
+ integration: projectIntegration,
46
+ crowdinId: organization,
47
+ });
44
48
  }
45
49
  (0, logger_1.log)(`Deleting all integration credentials for ${organization} organization`);
46
50
  yield (0, storage_1.getStorage)().deleteAllIntegrationCredentials(organization);
@@ -1,6 +1,7 @@
1
1
  import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks, Provider } from '../modules/integration/types';
2
- import { Config, CrowdinCredentials, UserErrors, UnauthorizedConfig } from '../models';
3
- import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../models/job';
2
+ import { Config, CrowdinCredentials, UnauthorizedConfig } from '../types';
3
+ import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../modules/integration/util/types';
4
+ import { UserErrors } from './types';
4
5
  export interface Storage {
5
6
  migrate(): Promise<void>;
6
7
  saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
@@ -1,7 +1,8 @@
1
1
  import { Storage } from '.';
2
- import { CrowdinCredentials, UserErrors } from '../models';
3
- import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../models/job';
2
+ import { CrowdinCredentials } from '../types';
3
+ import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../modules/integration/util/types';
4
4
  import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
5
+ import { UserErrors } from './types';
5
6
  export interface MySQLStorageConfig {
6
7
  uri?: string;
7
8
  host?: string;
@@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.MySQLStorage = void 0;
16
16
  const uuid_1 = require("uuid");
17
- const job_1 = require("../models/job");
17
+ const types_1 = require("../modules/integration/util/types");
18
18
  const util_1 = require("../util");
19
19
  class MySQLStorage {
20
20
  constructor(config) {
@@ -156,7 +156,7 @@ class MySQLStorage {
156
156
  payload text,
157
157
  title text,
158
158
  progress int 0,
159
- status varchar(255) '${job_1.JobStatus.CREATED}',
159
+ status varchar(255) '${types_1.JobStatus.CREATED}',
160
160
  payload text,
161
161
  info text,
162
162
  data text,
@@ -518,7 +518,7 @@ class MySQLStorage {
518
518
  if (status) {
519
519
  updateFields.push('status = ?');
520
520
  updateParams.push(status);
521
- if (!updateFields.includes('finished_at = ?') && [job_1.JobStatus.FAILED, job_1.JobStatus.CANCELED].includes(status)) {
521
+ if (!updateFields.includes('finished_at = ?') && [types_1.JobStatus.FAILED, types_1.JobStatus.CANCELED].includes(status)) {
522
522
  updateFields.push('finished_at = ?');
523
523
  updateParams.push(Date.now().toString());
524
524
  }
@@ -1,8 +1,9 @@
1
1
  import { Client } from 'pg';
2
2
  import { Storage } from '.';
3
- import { CrowdinCredentials, UserErrors } from '../models';
4
- import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../models/job';
3
+ import { CrowdinCredentials } from '../types';
5
4
  import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
5
+ import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../modules/integration/util/types';
6
+ import { UserErrors } from './types';
6
7
  export interface PostgreStorageConfig {
7
8
  host?: string;
8
9
  connectionString?: string;
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.PostgreStorage = void 0;
14
14
  const pg_1 = require("pg");
15
15
  const uuid_1 = require("uuid");
16
- const job_1 = require("../models/job");
16
+ const types_1 = require("../modules/integration/util/types");
17
17
  const util_1 = require("../util");
18
18
  class PostgreStorage {
19
19
  constructor(config) {
@@ -169,7 +169,7 @@ class PostgreStorage {
169
169
  type varchar not null,
170
170
  title varchar null,
171
171
  progress int default 0,
172
- status varchar default '${job_1.JobStatus.CREATED}',
172
+ status varchar default '${types_1.JobStatus.CREATED}',
173
173
  payload varchar null,
174
174
  info varchar null,
175
175
  data varchar null,
@@ -534,7 +534,7 @@ class PostgreStorage {
534
534
  if (status) {
535
535
  updateFields.push('status = $' + updateParams.length.toString());
536
536
  updateParams.push(status);
537
- if ((!progress || progress <= 100) && [job_1.JobStatus.FAILED, job_1.JobStatus.CANCELED].includes(status)) {
537
+ if ((!progress || progress <= 100) && [types_1.JobStatus.FAILED, types_1.JobStatus.CANCELED].includes(status)) {
538
538
  updateFields.push('finished_at = $' + updateParams.length.toString());
539
539
  updateParams.push(Date.now().toString());
540
540
  }
@@ -1,7 +1,8 @@
1
1
  import { Storage } from '.';
2
- import { CrowdinCredentials, UserErrors } from '../models';
3
- import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../models/job';
2
+ import { CrowdinCredentials } from '../types';
4
3
  import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
4
+ import { CreateJobParams, GetActiveJobsParams, GetJobParams, Job, UpdateJobParams } from '../modules/integration/util/types';
5
+ import { UserErrors } from './types';
5
6
  export interface SQLiteStorageConfig {
6
7
  dbFolder: string;
7
8
  }
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.SQLiteStorage = void 0;
17
17
  const path_1 = require("path");
18
18
  const uuid_1 = require("uuid");
19
- const job_1 = require("../models/job");
19
+ const types_1 = require("../modules/integration/util/types");
20
20
  class SQLiteStorage {
21
21
  constructor(config) {
22
22
  this.dbPromise = new Promise((res, rej) => {
@@ -247,7 +247,7 @@ class SQLiteStorage {
247
247
  type varchar not null,
248
248
  title varchar null,
249
249
  progress integer DEFAULT 0,
250
- status varchar DEFAULT '${job_1.JobStatus.CREATED}',
250
+ status varchar DEFAULT '${types_1.JobStatus.CREATED}',
251
251
  payload varchar null,
252
252
  info varchar null,
253
253
  data varchar null,
@@ -524,7 +524,7 @@ class SQLiteStorage {
524
524
  if (status) {
525
525
  updateFields.push('status = ?');
526
526
  updateParams.push(status);
527
- if (!updateFields.includes('finished_at = ?') && [job_1.JobStatus.FAILED, job_1.JobStatus.CANCELED].includes(status)) {
527
+ if (!updateFields.includes('finished_at = ?') && [types_1.JobStatus.FAILED, types_1.JobStatus.CANCELED].includes(status)) {
528
528
  updateFields.push('finished_at = ?');
529
529
  updateParams.push(Date.now().toString());
530
530
  }
@@ -0,0 +1,9 @@
1
+ export interface UserErrors {
2
+ id: number;
3
+ action: string;
4
+ message: string;
5
+ data: any;
6
+ createdAt: string;
7
+ crowdinId: string;
8
+ integrationId?: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,17 @@
1
1
  import Crowdin from '@crowdin/crowdin-api-client';
2
2
  import { JwtPayload, VerifyOptions } from '@crowdin/crowdin-apps-functions';
3
3
  import { Request } from 'express';
4
- import { CustomMTLogic } from '../modules/custom-mt/types';
5
- import { CustomSpellcheckerModule } from '../modules/custom-spell-check/types';
6
- import { EditorPanels } from '../modules/editor-right-panel/types';
7
- import { CustomFileFormatLogic, FilePostExportLogic, FilePostImportLogic, FilePreExportLogic, FilePreImportLogic } from '../modules/file-processing/types';
8
- import { IntegrationLogic } from '../modules/integration/types';
9
- import { MySQLStorageConfig } from '../storage/mysql';
10
- import { PostgreStorageConfig } from '../storage/postgre';
11
- import { LogErrorFunction, LogFunction } from '../util/logger';
4
+ import { ContextModule } from './modules/context-menu/types';
5
+ import { CustomMTLogic } from './modules/custom-mt/types';
6
+ import { CustomSpellcheckerModule } from './modules/custom-spell-check/types';
7
+ import { EditorPanels } from './modules/editor-right-panel/types';
8
+ import { EditorThemes } from './modules/editor-themes/types';
9
+ import { CustomFileFormatLogic, FilePostExportLogic, FilePostImportLogic, FilePreExportLogic, FilePreImportLogic } from './modules/file-processing/types';
10
+ import { IntegrationLogic } from './modules/integration/types';
11
+ import { MySQLStorageConfig } from './storage/mysql';
12
+ import { PostgreStorageConfig } from './storage/postgre';
13
+ import { ApiModule } from './modules/api/types';
14
+ import { LogErrorFunction, LogFunction } from './util/logger';
12
15
  export interface ClientConfig extends ImagePath {
13
16
  /**
14
17
  * Authentication Crowdin App type: "authorization_code", "crowdin_app". Default: "crowdin_app"
@@ -170,7 +173,7 @@ export interface ClientConfig extends ImagePath {
170
173
  customSpellchecker?: CustomSpellcheckerModule;
171
174
  }
172
175
  export interface Environments {
173
- environments: Environment | Environment[];
176
+ environments?: Environment | Environment[];
174
177
  }
175
178
  type Environment = 'crowdin' | 'crowdin-enterprise';
176
179
  export type Config = ClientConfig & {
@@ -254,22 +257,6 @@ export interface SubscriptionInfo {
254
257
  daysLeft?: number;
255
258
  type?: SubscriptionInfoType;
256
259
  }
257
- export interface EditorThemes {
258
- /**
259
- * Module name
260
- */
261
- name?: string;
262
- /**
263
- * Defines a set of CSS custom variables for theming purposes
264
- */
265
- styles: {
266
- [key: string]: string;
267
- };
268
- /**
269
- * The Editor's mode list where the module will be available.
270
- */
271
- modes: EditorMode[];
272
- }
273
260
  export declare enum EditorMode {
274
261
  ASSETS = "assets",
275
262
  REVIEW = "review",
@@ -282,36 +269,6 @@ interface ModuleContent {
282
269
  */
283
270
  url?: string;
284
271
  }
285
- export interface ContextModule {
286
- location: ContextOptionsLocations;
287
- type: ContextOptionsTypes;
288
- module: string;
289
- /**
290
- * Context menu name
291
- */
292
- name?: string;
293
- /**
294
- * Support fileName pattern only. Contains fileName field regular expressions used to detect the file type. If the file name matches any of the regular expressions, the context menu will be displayed.
295
- */
296
- signaturePatterns?: SignaturePatterns;
297
- }
298
- export interface SignaturePatterns {
299
- fileName?: string;
300
- fileContent?: string;
301
- }
302
- export declare enum ContextOptionsLocations {
303
- TM = "tm",
304
- GLOSSARY = "glossary",
305
- LANGUAGE = "language",
306
- SCREENSHOT = "screenshot",
307
- SOURCE_FILE = "source_file",
308
- TRANSLATED_FILE = "translated_file"
309
- }
310
- export declare enum ContextOptionsTypes {
311
- MODAL = "modal",
312
- NEW_TAB = "new_tab",
313
- REDIRECT = "redirect"
314
- }
315
272
  export interface CrowdinAppUtilities extends CrowdinMetadataStore {
316
273
  establishCrowdinConnection: (authRequest: string | CrowdinClientRequest) => Promise<{
317
274
  context: CrowdinContextInfo;
@@ -368,41 +325,12 @@ export interface UiModule {
368
325
  */
369
326
  name?: string;
370
327
  }
371
- export interface UserErrors {
372
- id: number;
373
- action: string;
374
- message: string;
375
- data: any;
376
- createdAt: string;
377
- crowdinId: string;
378
- integrationId?: string;
379
- }
380
328
  export interface ImagePath {
381
329
  /**
382
330
  * path to app logo (e.g. {@example join(__dirname, 'logo.png')})
383
331
  */
384
332
  imagePath?: string;
385
333
  }
386
- export declare enum RequestMethods {
387
- GET = "GET",
388
- POST = "POST",
389
- PUT = "PUT",
390
- PATCH = "PATCH",
391
- DELETE = "DELETE"
392
- }
393
- export interface ApiEndpoints {
394
- key: string;
395
- name: string;
396
- url: string;
397
- method: RequestMethods;
398
- description?: string;
399
- documentationUrl?: string;
400
- }
401
- export interface ApiModule {
402
- default?: boolean;
403
- endpoints?: ApiEndpoints[];
404
- docFile?: string;
405
- }
406
334
  export interface Logger {
407
335
  enabled: boolean;
408
336
  log?: (message: string, context?: CrowdinContextInfo) => void;
@@ -439,4 +367,8 @@ export interface AWSConfig {
439
367
  */
440
368
  region?: string;
441
369
  }
370
+ export interface SignaturePatterns {
371
+ fileName?: string;
372
+ fileContent?: string;
373
+ }
442
374
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectPermissions = exports.UserPermissions = exports.RequestMethods = exports.ContextOptionsTypes = exports.ContextOptionsLocations = exports.EditorMode = exports.SubscriptionInfoType = exports.AccountType = exports.Scope = exports.AuthenticationType = void 0;
3
+ exports.ProjectPermissions = exports.UserPermissions = exports.EditorMode = exports.SubscriptionInfoType = exports.AccountType = exports.Scope = exports.AuthenticationType = void 0;
4
4
  var AuthenticationType;
5
5
  (function (AuthenticationType) {
6
6
  AuthenticationType["CODE"] = "authorization_code";
@@ -45,29 +45,6 @@ var EditorMode;
45
45
  EditorMode["TRANSLATE"] = "TRANSLATE";
46
46
  EditorMode["PROOFREAD"] = "proofread";
47
47
  })(EditorMode = exports.EditorMode || (exports.EditorMode = {}));
48
- var ContextOptionsLocations;
49
- (function (ContextOptionsLocations) {
50
- ContextOptionsLocations["TM"] = "tm";
51
- ContextOptionsLocations["GLOSSARY"] = "glossary";
52
- ContextOptionsLocations["LANGUAGE"] = "language";
53
- ContextOptionsLocations["SCREENSHOT"] = "screenshot";
54
- ContextOptionsLocations["SOURCE_FILE"] = "source_file";
55
- ContextOptionsLocations["TRANSLATED_FILE"] = "translated_file";
56
- })(ContextOptionsLocations = exports.ContextOptionsLocations || (exports.ContextOptionsLocations = {}));
57
- var ContextOptionsTypes;
58
- (function (ContextOptionsTypes) {
59
- ContextOptionsTypes["MODAL"] = "modal";
60
- ContextOptionsTypes["NEW_TAB"] = "new_tab";
61
- ContextOptionsTypes["REDIRECT"] = "redirect";
62
- })(ContextOptionsTypes = exports.ContextOptionsTypes || (exports.ContextOptionsTypes = {}));
63
- var RequestMethods;
64
- (function (RequestMethods) {
65
- RequestMethods["GET"] = "GET";
66
- RequestMethods["POST"] = "POST";
67
- RequestMethods["PUT"] = "PUT";
68
- RequestMethods["PATCH"] = "PATCH";
69
- RequestMethods["DELETE"] = "DELETE";
70
- })(RequestMethods = exports.RequestMethods || (exports.RequestMethods = {}));
71
48
  var UserPermissions;
72
49
  (function (UserPermissions) {
73
50
  UserPermissions["OWNER"] = "owner";
@@ -1,6 +1,6 @@
1
1
  import Crowdin from '@crowdin/crowdin-api-client';
2
- import { AccountType, Config, CrowdinContextInfo, CrowdinCredentials, SubscriptionInfo, UnauthorizedConfig } from '../models';
3
2
  import { IntegrationCredentials, IntegrationLogic } from '../modules/integration/types';
3
+ import { Config, CrowdinContextInfo, CrowdinCredentials } from '../types';
4
4
  export declare function prepareCrowdinClient({ config, credentials, autoRenew, context, }: {
5
5
  config: Config;
6
6
  credentials: CrowdinCredentials;
@@ -11,11 +11,3 @@ export declare function prepareCrowdinClient({ config, credentials, autoRenew, c
11
11
  token: string;
12
12
  }>;
13
13
  export declare function prepareIntegrationCredentials(config: Config, integration: IntegrationLogic, integrationCredentials: IntegrationCredentials): Promise<any>;
14
- export declare function clearCache(organization: string): void;
15
- export declare function isAppFree(config: Config | UnauthorizedConfig): boolean;
16
- export declare function checkSubscription({ config, token, organization, accountType, }: {
17
- config: Config;
18
- token: string;
19
- organization: string;
20
- accountType: AccountType;
21
- }): Promise<SubscriptionInfo>;