@crowdin/app-project-module 2.10.0 → 2.11.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/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import express from './util/terminus-express';
4
4
  import { getRequestCredentialsMasker, postRequestCredentialsMasker, maskKey } from './util/credentials-masker';
5
5
  export { getRequestCredentialsMasker, postRequestCredentialsMasker, maskKey };
6
6
  export * from './types';
7
+ export { KeyExistsError, StorageApiError } from '@crowdin/apps-storage';
7
8
  export { Cron } from './util/cron';
8
9
  /** for app code that fans work out inside one request or job: each branch opens its own log scope */
9
10
  export { runWithContext } from '@crowdin/logs-formatter';
package/out/index.js CHANGED
@@ -48,7 +48,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
48
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
49
49
  };
50
50
  Object.defineProperty(exports, "__esModule", { value: true });
51
- exports.metadataStore = exports.reportAdvisorInsight = exports.express = exports.runWithContext = exports.maskKey = exports.postRequestCredentialsMasker = exports.getRequestCredentialsMasker = void 0;
51
+ exports.metadataStore = exports.reportAdvisorInsight = exports.express = exports.runWithContext = exports.StorageApiError = exports.KeyExistsError = exports.maskKey = exports.postRequestCredentialsMasker = exports.getRequestCredentialsMasker = void 0;
52
52
  exports.createApp = createApp;
53
53
  exports.addCrowdinEndpoints = addCrowdinEndpoints;
54
54
  const logsFormatter = __importStar(require("@crowdin/logs-formatter"));
@@ -70,6 +70,7 @@ const types_1 = require("./types");
70
70
  const util_1 = require("./util");
71
71
  const form_schema_1 = require("./util/form-schema");
72
72
  const connection_1 = require("./util/connection");
73
+ const crowdin_storage_1 = require("./util/crowdin-storage");
73
74
  const log_sanitizer_1 = require("./util/log-sanitizer");
74
75
  const logger = __importStar(require("./util/logger"));
75
76
  const logger_1 = require("./util/logger");
@@ -111,6 +112,9 @@ const automationAction = __importStar(require("./modules/automation-action"));
111
112
  const authGuard = __importStar(require("./modules/auth-guard"));
112
113
  const subscription_1 = require("./util/subscription");
113
114
  __exportStar(require("./types"), exports);
115
+ var apps_storage_1 = require("@crowdin/apps-storage");
116
+ Object.defineProperty(exports, "KeyExistsError", { enumerable: true, get: function () { return apps_storage_1.KeyExistsError; } });
117
+ Object.defineProperty(exports, "StorageApiError", { enumerable: true, get: function () { return apps_storage_1.StorageApiError; } });
114
118
  /** for app code that fans work out inside one request or job: each branch opens its own log scope */
115
119
  var logs_formatter_1 = require("@crowdin/logs-formatter");
116
120
  Object.defineProperty(exports, "runWithContext", { enumerable: true, get: function () { return logs_formatter_1.runWithContext; } });
@@ -240,6 +244,8 @@ function addCrowdinEndpoints(app, clientConfig) {
240
244
  throw new Error('Encrypting Crowdin connection is not available in unauthorized config');
241
245
  }, decryptCrowdinConnection: () => {
242
246
  throw new Error('Decrypting Crowdin connection is not available in unauthorized config');
247
+ }, crowdinStorage: () => {
248
+ throw new Error('Crowdin storage is not available in unauthorized config');
243
249
  }, jwtMiddleware: () => {
244
250
  throw new Error('JWT Middleware is not available in unauthorized config');
245
251
  } });
@@ -309,7 +315,7 @@ function addCrowdinEndpoints(app, clientConfig) {
309
315
  checkSubscriptionExpiration: (_b = options.checkSubscriptionExpiration) !== null && _b !== void 0 ? _b : false,
310
316
  moduleKey: options.moduleKey,
311
317
  });
312
- } });
318
+ }, crowdinStorage: (crowdinId) => (0, crowdin_storage_1.createCrowdinStorage)(config, crowdinId) });
313
319
  }
314
320
  function addFormSchema({ app, config }) {
315
321
  const allModuleConfigs = [];
@@ -360,11 +366,10 @@ function convertClientConfig(clientConfig) {
360
366
  throw new Error('Missing [clientId, clientSecret] parameters');
361
367
  }
362
368
  }
363
- if (clientConfig.projectIntegration) {
364
- clientConfig.api = Object.assign({ default: true }, clientConfig.api);
365
- }
366
- clientConfig.enableStatusPage = Object.assign({ database: true, filesystem: true }, (clientConfig.enableStatusPage || {}));
367
- return Object.assign(Object.assign({}, clientConfig), { baseUrl: baseUrl ? (baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl) : undefined, clientId,
369
+ const api = clientConfig.projectIntegration ? Object.assign({ default: true }, clientConfig.api) : clientConfig.api;
370
+ const enableStatusPage = Object.assign({ database: true, filesystem: true }, (clientConfig.enableStatusPage || {}));
371
+ return Object.assign(Object.assign({}, clientConfig), { api,
372
+ enableStatusPage, baseUrl: baseUrl ? (baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl) : undefined, clientId,
368
373
  clientSecret, awsConfig: {
369
374
  tmpBucketName,
370
375
  region,