@crowdin/app-project-module 0.34.1 → 0.35.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.
@@ -65,6 +65,7 @@ function handle(config, integration) {
65
65
  appIdentifier: config.identifier,
66
66
  }
67
67
  : null;
68
+ options.notice = integration.notice;
68
69
  logger(`Routing user to ${view} view`);
69
70
  return res.render(view, options);
70
71
  }));
package/out/index.js CHANGED
@@ -186,22 +186,27 @@ function addCrowdinEndpoints(app, clientConfig) {
186
186
  }
187
187
  }
188
188
  if (config.customFileFormat) {
189
+ (0, defaults_1.applyFileProcessorsModuleDefaults)(config, config.customFileFormat);
189
190
  app.post('/process', (0, crowdin_client_1.default)(config), (0, custom_file_format_1.default)(config.baseUrl, config.customFileFormat.filesFolder || config.dbFolder, config.customFileFormat));
190
191
  app.get('/file/download', (0, file_download_1.default)(config, config.customFileFormat, 'custom-file-format'));
191
192
  }
192
193
  if (config.filePreImport) {
194
+ (0, defaults_1.applyFileProcessorsModuleDefaults)(config, config.filePreImport);
193
195
  app.post('/pre-import', (0, crowdin_client_1.default)(config), (0, pre_post_process_1.default)(config, config.filePreImport, models_1.ProcessFileJobType.PRE_IMPORT));
194
196
  app.get(`/file/download/${models_1.ProcessFileJobType.PRE_IMPORT}`, (0, file_download_1.default)(config, config.filePreImport, models_1.ProcessFileJobType.PRE_IMPORT));
195
197
  }
196
198
  if (config.filePostImport) {
199
+ (0, defaults_1.applyFileProcessorsModuleDefaults)(config, config.filePostImport);
197
200
  app.post('/post-import', (0, crowdin_client_1.default)(config), (0, pre_post_process_1.default)(config, config.filePostImport, models_1.ProcessFileJobType.POST_IMPORT));
198
201
  app.get(`/file/download/${models_1.ProcessFileJobType.POST_IMPORT}`, (0, file_download_1.default)(config, config.filePostImport, models_1.ProcessFileJobType.POST_IMPORT));
199
202
  }
200
203
  if (config.filePreExport) {
204
+ (0, defaults_1.applyFileProcessorsModuleDefaults)(config, config.filePreExport);
201
205
  app.post('/pre-export', (0, crowdin_client_1.default)(config), (0, pre_post_process_1.default)(config, config.filePreExport, models_1.ProcessFileJobType.PRE_EXPORT));
202
206
  app.get(`/file/download/${models_1.ProcessFileJobType.PRE_EXPORT}`, (0, file_download_1.default)(config, config.filePreExport, models_1.ProcessFileJobType.PRE_EXPORT));
203
207
  }
204
208
  if (config.filePostExport) {
209
+ (0, defaults_1.applyFileProcessorsModuleDefaults)(config, config.filePostExport);
205
210
  app.post('/post-export', (0, crowdin_client_1.default)(config), (0, pre_post_process_1.default)(config, config.filePostExport, models_1.ProcessFileJobType.POST_EXPORT));
206
211
  app.get(`/file/download/${models_1.ProcessFileJobType.POST_EXPORT}`, (0, file_download_1.default)(config, config.filePostExport, models_1.ProcessFileJobType.POST_EXPORT));
207
212
  }
@@ -36,7 +36,7 @@ function prepareCrowdinRequest(jwtToken, config, optional = false, checkSubscrip
36
36
  throw new Error("Can't find organization by id");
37
37
  }
38
38
  logInfo('Building crowdin client instance');
39
- const { client, token } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials });
39
+ const { client, token } = yield (0, connection_1.prepareCrowdinClient)({ config, credentials, autoRenew: true });
40
40
  let subscriptionInfo;
41
41
  if (checkSubscriptionExpiration) {
42
42
  subscriptionInfo = yield (0, connection_1.checkSubscription)({
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import Crowdin, { LanguagesModel, SourceFilesModel, SourceStringsModel, TranslationStatusModel } from '@crowdin/crowdin-api-client';
2
3
  import { JwtPayload, VerifyOptions } from '@crowdin/crowdin-apps-functions';
3
4
  import { Request } from 'express';
@@ -156,6 +157,12 @@ export interface ClientConfig extends ImagePath {
156
157
  * Disable formatting logs
157
158
  */
158
159
  disableLogsFormatter?: boolean;
160
+ /**
161
+ * AWS configuration for uploading big files to temporary bucket. Used with customFileFormat and file processors modules.
162
+ *
163
+ * Not necessary to configure if environment variables AWS_REGION and AWS_TMP_BUCKET_NAME are properly set.
164
+ */
165
+ awsConfig?: AWSConfig;
159
166
  }
160
167
  export type Config = ClientConfig & {
161
168
  baseUrl: string;
@@ -296,6 +303,16 @@ export interface IntegrationLogic {
296
303
  * Register Crowdin webhook to get notified when translations are ready
297
304
  */
298
305
  webhooks?: Webhooks;
306
+ /**
307
+ * define a notification for your application at the top of the screen
308
+ */
309
+ notice?: {
310
+ title: string;
311
+ content: string;
312
+ type: NoticeType;
313
+ icon: boolean;
314
+ close: boolean;
315
+ };
299
316
  }
300
317
  export type FormEntity = FormField | FormDelimiter;
301
318
  export interface FormDelimiter {
@@ -622,7 +639,7 @@ export interface ProcessFileRequest {
622
639
  targetLanguages: LanguagesModel.Language[];
623
640
  strings: ProcessFileString[];
624
641
  stringsUrl: string;
625
- getRawContent?: (encoding: string) => Promise<string>;
642
+ getRawContent?: (encoding: BufferEncoding) => Promise<string>;
626
643
  }
627
644
  export interface ProcessFileRecord {
628
645
  content?: string;
@@ -909,4 +926,15 @@ export interface DefaultPermissions {
909
926
  user?: UserPermissions;
910
927
  project?: ProjectPermissions;
911
928
  }
929
+ type NoticeType = 'info' | 'warning' | 'danger' | 'success' | 'error' | 'dataLostWarning';
930
+ export interface AWSConfig {
931
+ /**
932
+ * AWS bucket name for temporary files
933
+ */
934
+ tmpBucketName?: string;
935
+ /**
936
+ * AWS region
937
+ */
938
+ region?: string;
939
+ }
912
940
  export {};