@crowdin/app-project-module 0.35.0 → 0.36.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.
@@ -37,8 +37,7 @@ function handle(baseUrl, folder, config) {
37
37
  file = Buffer.from(body.file.content, 'base64');
38
38
  }
39
39
  else if (body.file.contentUrl) {
40
- const rawContent = yield (0, files_1.getFileContent)(body.file.contentUrl);
41
- file = Buffer.from(rawContent).toString('base64');
40
+ file = yield (0, files_1.getFileContent)(body.file.contentUrl);
42
41
  }
43
42
  let response = {};
44
43
  let error;
@@ -71,7 +70,7 @@ function handleBuildFile(baseUrl, dataFolder, config, req, client, context, proj
71
70
  strings = req.strings;
72
71
  }
73
72
  else {
74
- strings = yield (0, files_1.getFileContent)(req.stringsUrl, true);
73
+ strings = yield (0, files_1.getFileStrings)(req.stringsUrl);
75
74
  }
76
75
  let res;
77
76
  if ((req.file.id || !file) && config.exportStrings) {
@@ -113,9 +112,8 @@ function handleParseFile(baseUrl, dataFolder, config, req, client, context, proj
113
112
  maxSize = maxSize / 2;
114
113
  }
115
114
  if (res.previewFile) {
116
- const previewFileEncoded = Buffer.from(res.previewFile).toString('base64');
117
- if (Buffer.byteLength(previewFileEncoded, 'utf8') < maxSize) {
118
- response.preview = previewFileEncoded;
115
+ if (Buffer.byteLength(res.previewFile) < maxSize) {
116
+ response.preview = res.previewFile.toString('base64');
119
117
  }
120
118
  else {
121
119
  let url;
@@ -141,16 +139,17 @@ function handleParseFile(baseUrl, dataFolder, config, req, client, context, proj
141
139
  });
142
140
  }
143
141
  const stringsNDJson = strings.map((s) => JSON.stringify(s)).join('\n\r');
144
- if (Buffer.byteLength(stringsNDJson, 'utf8') < maxSize) {
142
+ const bufferData = Buffer.from(stringsNDJson, 'utf8');
143
+ if (Buffer.byteLength(bufferData) < maxSize) {
145
144
  response.strings = strings;
146
145
  }
147
146
  else {
148
147
  let url;
149
148
  if (config.storeFile) {
150
- url = yield config.storeFile(stringsNDJson);
149
+ url = yield config.storeFile(bufferData);
151
150
  }
152
151
  else {
153
- const storedFile = yield (0, files_1.storeFile)(stringsNDJson, path_1.default.join(dataFolder, 'custom-file-format'));
152
+ const storedFile = yield (0, files_1.storeFile)(bufferData, path_1.default.join(dataFolder, 'custom-file-format'));
154
153
  url = `${baseUrl}?file=${storedFile}`;
155
154
  }
156
155
  response.stringsUrl = url;
@@ -30,14 +30,14 @@ function handle(baseConfig, config, folderName) {
30
30
  let fileContent;
31
31
  let rawContent;
32
32
  if (body.stringsUrl) {
33
- fileContent = yield (0, files_1.getFileContent)(body.stringsUrl, true);
33
+ fileContent = yield (0, files_1.getFileStrings)(body.stringsUrl);
34
34
  }
35
35
  else if (body.strings) {
36
36
  fileContent = body.strings;
37
37
  }
38
38
  else if (body.file.contentUrl) {
39
39
  rawContent = yield (0, files_1.getFileContent)(body.file.contentUrl);
40
- fileContent = Buffer.from(rawContent).toString('base64');
40
+ fileContent = rawContent;
41
41
  }
42
42
  else if (body.file.content) {
43
43
  rawContent = body.file.content;
@@ -45,18 +45,24 @@ function handle(baseConfig, config, folderName) {
45
45
  }
46
46
  if (body.jobType === models_1.ProcessFileJobType.PRE_IMPORT || body.jobType === models_1.ProcessFileJobType.POST_EXPORT) {
47
47
  body.getRawContent = (encoding) => __awaiter(this, void 0, void 0, function* () {
48
- return Buffer.from(rawContent, 'base64').toString(encoding);
48
+ if (typeof rawContent === 'string') {
49
+ return Buffer.from(rawContent, 'base64').toString(encoding);
50
+ }
51
+ return rawContent;
49
52
  });
50
53
  }
51
54
  const fileProcessResult = yield config.fileProcess(body, fileContent, req.crowdinApiClient, req.crowdinContext, req.crowdinContext.jwtPayload.context.project_id);
55
+ if (fileProcessResult.notModified) {
56
+ res.sendStatus(304);
57
+ return;
58
+ }
52
59
  switch (body.jobType) {
53
60
  case models_1.ProcessFileJobType.PRE_IMPORT:
54
61
  case models_1.ProcessFileJobType.POST_EXPORT:
55
- const { contentFile, base64EncodedContent, fileName, fileType, error: contentFileError, } = fileProcessResult;
62
+ const { contentFile, fileName, fileType, error: contentFileError, } = fileProcessResult;
56
63
  if (contentFile) {
57
- const contentFileEncoded = base64EncodedContent || Buffer.from(contentFile).toString('base64');
58
- if (Buffer.byteLength(contentFileEncoded, 'utf8') < files_1.MAX_BODY_SIZE) {
59
- response.content = contentFileEncoded;
64
+ if (Buffer.byteLength(contentFile) < files_1.MAX_BODY_SIZE) {
65
+ response.content = contentFile.toString('base64');
60
66
  }
61
67
  else {
62
68
  let url;
@@ -83,16 +89,17 @@ function handle(baseConfig, config, folderName) {
83
89
  const { strings, error: stringsFileError } = fileProcessResult;
84
90
  if (strings) {
85
91
  const stringsNDJson = strings.map((s) => JSON.stringify(s)).join('\n\r');
86
- if (Buffer.byteLength(stringsNDJson, 'utf8') < files_1.MAX_BODY_SIZE) {
92
+ const bufferData = Buffer.from(stringsNDJson, 'utf-8');
93
+ if (Buffer.byteLength(bufferData) < files_1.MAX_BODY_SIZE) {
87
94
  response.strings = strings;
88
95
  }
89
96
  else {
90
97
  let url;
91
98
  if (config.storeFile) {
92
- url = yield config.storeFile(stringsNDJson);
99
+ url = yield config.storeFile(bufferData);
93
100
  }
94
101
  else {
95
- const storedFile = yield (0, files_1.storeFile)(stringsNDJson, path_1.default.join(folderPath, folderName));
102
+ const storedFile = yield (0, files_1.storeFile)(bufferData, path_1.default.join(folderPath, folderName));
96
103
  url = `${baseFilesUrl}?file=${storedFile}`;
97
104
  }
98
105
  response.stringsUrl = url;
@@ -9,12 +9,61 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const models_1 = require("../../models");
13
12
  const storage_1 = require("../../storage");
13
+ const logger_1 = require("../../util/logger");
14
14
  const util_1 = require("../../util");
15
15
  const cron_1 = require("../../util/cron");
16
- const file_snapshot_1 = require("../../util/file-snapshot");
17
16
  const webhooks_1 = require("../../util/webhooks");
17
+ const models_1 = require("../../models");
18
+ function filterSyncFiles(args) {
19
+ var _a, _b;
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const { projectId, crowdinClient, events, syncFileSettings, appSettings } = args;
22
+ const files = {};
23
+ let projectData;
24
+ const addFileToResponse = (fileId, languages) => {
25
+ if (files[fileId]) {
26
+ files[fileId] = [...new Set([...files[fileId], ...languages])];
27
+ }
28
+ else {
29
+ files[fileId] = languages;
30
+ }
31
+ };
32
+ for (const event of events) {
33
+ const fileId = event.fileId;
34
+ const language = event.language;
35
+ // sync all new files
36
+ if (event.event === webhooks_1.HookEvents.fileAdded && appSettings['new-crowdin-files']) {
37
+ if (!projectData) {
38
+ projectData = yield crowdinClient.projectsGroupsApi.getProject(projectId);
39
+ }
40
+ addFileToResponse(fileId, projectData.data.targetLanguageIds);
41
+ continue;
42
+ }
43
+ // sync file that was selected for sync schedule
44
+ if (syncFileSettings[fileId]) {
45
+ if (!syncFileSettings[fileId].includes(language)) {
46
+ continue;
47
+ }
48
+ addFileToResponse(fileId, [language]);
49
+ }
50
+ else {
51
+ try {
52
+ const crowdinFile = yield crowdinClient.sourceFilesApi.getFile(projectId, fileId);
53
+ // sync file that in selected for sync schedule directory
54
+ if (syncFileSettings[(_a = crowdinFile === null || crowdinFile === void 0 ? void 0 : crowdinFile.data) === null || _a === void 0 ? void 0 : _a.directoryId] &&
55
+ syncFileSettings[(_b = crowdinFile === null || crowdinFile === void 0 ? void 0 : crowdinFile.data) === null || _b === void 0 ? void 0 : _b.directoryId].includes(language)) {
56
+ addFileToResponse(fileId, [language]);
57
+ }
58
+ }
59
+ catch (e) {
60
+ (0, logger_1.logError)(e);
61
+ }
62
+ }
63
+ }
64
+ return files;
65
+ });
66
+ }
18
67
  function handle(config, integration) {
19
68
  return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
20
69
  var _a, _b;
@@ -22,31 +71,45 @@ function handle(config, integration) {
22
71
  const webhookUrlParam = req.query[urlParam];
23
72
  let filesToSync;
24
73
  if (webhookUrlParam) {
25
- const { projectId, crowdinClient, preparedIntegrationCredentials, rootFolder, appSettings, syncSettings, newFiles, } = yield (0, webhooks_1.prepareWebhookData)(config, integration, webhookUrlParam, models_1.Provider.CROWDIN);
74
+ const { projectId, crowdinClient, rootFolder, appSettings, syncSettings } = yield (0, webhooks_1.prepareWebhookData)(config, integration, webhookUrlParam, models_1.Provider.CROWDIN);
26
75
  if (!crowdinClient) {
27
76
  return res.status(403).send({ error: 'Access denied' });
28
77
  }
29
78
  if (!syncSettings) {
30
79
  return res.status(200).send({ message: 'Sync is not configured' });
31
80
  }
81
+ const syncFileSettings = JSON.parse(syncSettings.files);
32
82
  if ((_b = integration.webhooks) === null || _b === void 0 ? void 0 : _b.crowdinWebhookInterceptor) {
33
83
  filesToSync = yield integration.webhooks.crowdinWebhookInterceptor(projectId, crowdinClient.client, rootFolder, appSettings, syncSettings, req.body);
34
84
  }
35
85
  else {
36
- filesToSync = (0, webhooks_1.filterSyncFiles)(req.body.events, JSON.parse(syncSettings.files));
86
+ filesToSync = yield filterSyncFiles({
87
+ projectId,
88
+ crowdinClient: crowdinClient.client,
89
+ events: req.body.events,
90
+ syncFileSettings,
91
+ appSettings,
92
+ });
93
+ }
94
+ for (const eventPayload of req.body.events) {
95
+ if (eventPayload.event === webhooks_1.HookEvents.fileDeleted) {
96
+ yield (0, storage_1.getStorage)().deleteWebhooks([eventPayload.fileId], syncSettings.integrationId, syncSettings.crowdinId, syncSettings.provider);
97
+ delete filesToSync[eventPayload.fileId];
98
+ delete syncFileSettings[eventPayload.fileId];
99
+ }
37
100
  }
38
- const crowdinFiles = yield (0, cron_1.skipFoldersFromIntegrationRequest)(config, integration, projectId, Object.assign(Object.assign({}, filesToSync), newFiles), crowdinClient.client);
39
- const result = yield integration.updateIntegration(projectId, crowdinClient.client, preparedIntegrationCredentials, crowdinFiles, rootFolder, appSettings);
40
- if (newFiles) {
41
- yield (0, storage_1.getStorage)().updateSyncSettings(JSON.stringify(Object.assign(Object.assign({}, filesToSync), newFiles)), syncSettings.integrationId, syncSettings.crowdinId, 'schedule', syncSettings.provider);
42
- const currentFileSnapshot = yield (0, file_snapshot_1.getCrowdinSnapshot)(config, integration, crowdinClient.client, projectId, appSettings);
43
- yield (0, storage_1.getStorage)().updateFilesSnapshot(JSON.stringify(currentFileSnapshot), syncSettings.integrationId, syncSettings.crowdinId, syncSettings.provider);
101
+ const crowdinFiles = yield (0, cron_1.skipFoldersFromIntegrationRequest)(config, integration, projectId, filesToSync, crowdinClient.client);
102
+ for (const fileId in crowdinFiles) {
103
+ const webhook = yield (0, storage_1.getStorage)().getWebhooks(fileId, syncSettings.integrationId, syncSettings.crowdinId, syncSettings.provider);
104
+ if (!webhook) {
105
+ yield (0, storage_1.getStorage)().saveWebhooks(fileId, syncSettings.integrationId, syncSettings.crowdinId, syncSettings.provider);
106
+ }
44
107
  }
45
- let message;
46
- if ((0, util_1.isExtendedResultType)(result)) {
47
- message = result.message;
108
+ const newFileIds = Object.keys(crowdinFiles).filter((fileId) => !syncFileSettings[fileId]);
109
+ if (newFileIds.length) {
110
+ yield (0, storage_1.getStorage)().updateSyncSettings(JSON.stringify(Object.assign(Object.assign({}, syncFileSettings), crowdinFiles)), syncSettings.integrationId, syncSettings.crowdinId, 'schedule', syncSettings.provider);
48
111
  }
49
- res.send({ message });
112
+ res.send({});
50
113
  }
51
114
  }));
52
115
  }
@@ -25,12 +25,8 @@ function handle(config, integration) {
25
25
  if (!webhookData.syncSettings) {
26
26
  return res.status(200).send({ message: 'Sync is not configured' });
27
27
  }
28
- const result = yield (0, webhooks_1.updateCrowdinFromWebhookRequest)({ integration, webhookData, req });
29
- let message;
30
- if ((0, util_1.isExtendedResultType)(result)) {
31
- message = result.message;
32
- }
33
- res.send({ message });
28
+ yield (0, webhooks_1.updateCrowdinFromWebhookRequest)({ integration, webhookData, req });
29
+ res.send({});
34
30
  }
35
31
  else {
36
32
  return res.status(403).send({ error: 'Access denied' });
@@ -23,11 +23,13 @@ function handle(config, integration) {
23
23
  if (integration.webhooks) {
24
24
  yield (0, webhooks_1.registerWebhooks)(config, integration, req.crowdinApiClient, req.crowdinContext, req.integrationCredentials, appSettings);
25
25
  }
26
- if (appSettings['new-crowdin-files']) {
27
- (0, file_snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, models_1.Provider.CROWDIN);
28
- }
29
- if (appSettings['new-integration-files']) {
30
- (0, file_snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, models_1.Provider.INTEGRATION);
26
+ else {
27
+ if (appSettings['new-crowdin-files']) {
28
+ (0, file_snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, models_1.Provider.CROWDIN);
29
+ }
30
+ if (appSettings['new-integration-files']) {
31
+ (0, file_snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, models_1.Provider.INTEGRATION);
32
+ }
31
33
  }
32
34
  if (integration.syncNewElements) {
33
35
  yield (0, cron_1.createOrUpdateSyncSettings)(config, req, {}, models_1.Provider.CROWDIN, true);
@@ -17,7 +17,8 @@ function handle(config, integration) {
17
17
  var _a;
18
18
  const { files, provider } = req.body;
19
19
  yield (0, cron_1.createOrUpdateSyncSettings)(config, req, files, provider);
20
- if ((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[provider]) {
20
+ const appSettings = req.integrationSettings || {};
21
+ if (((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[provider]) && appSettings[`new-${provider}-files`]) {
21
22
  yield (0, file_snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, provider);
22
23
  }
23
24
  res.status(204).end();
@@ -571,7 +571,7 @@ export interface FileProcessLogic {
571
571
  /**
572
572
  * Override to store huge responses (by default they will be stored in fs)
573
573
  */
574
- storeFile?: (content: string) => Promise<string>;
574
+ storeFile?: (content: Buffer) => Promise<string>;
575
575
  }
576
576
  export interface CustomFileFormatLogic extends FileProcessLogic {
577
577
  /**
@@ -605,28 +605,29 @@ export interface CustomFileFormatLogic extends FileProcessLogic {
605
605
  /**
606
606
  * Used for initial source file upload, source file update, and translation upload
607
607
  */
608
- parseFile?: (fileContent: string | object, req: Omit<ProcessFileRequest, 'jobType' | 'file'>, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ParseFileResponse>;
608
+ parseFile?: (fileContent: Buffer, req: Omit<ProcessFileRequest, 'jobType' | 'file'>, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ParseFileResponse>;
609
609
  /**
610
610
  * Used for translation download
611
611
  */
612
- buildFile?: (fileContent: string | object, req: Omit<ProcessFileRequest, 'jobType' | 'file'>, strings: ProcessFileString[], client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
612
+ buildFile?: (fileContent: Buffer, req: Omit<ProcessFileRequest, 'jobType' | 'file'>, strings: ProcessFileString[], client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
613
613
  /**
614
614
  * Used for strings export
615
615
  */
616
616
  exportStrings?: (req: Omit<ProcessFileRequest, 'jobType'>, strings: ProcessFileString[], client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
617
617
  }
618
618
  export type FileImportExportLogic = FilePreImportLogic | FilePostImportLogic | FilePreExportLogic | FilePostExportLogic;
619
+ export type FileImportExportContent = ProcessFileString[] | Buffer | undefined;
619
620
  export interface FilePreImportLogic extends FileProcessLogic {
620
- fileProcess: (req: ProcessFileRequest, content: string, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
621
+ fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ContentFileResponse>;
621
622
  }
622
623
  export interface FilePostImportLogic extends FileProcessLogic {
623
- fileProcess: (req: ProcessFileRequest, content: string, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ParseFileResponse>;
624
+ fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<StringsFileResponse>;
624
625
  }
625
626
  export interface FilePreExportLogic extends FileProcessLogic {
626
- fileProcess: (req: ProcessFileRequest, content: string, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ParseFileResponse>;
627
+ fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<StringsFileResponse>;
627
628
  }
628
629
  export interface FilePostExportLogic extends FileProcessLogic {
629
- fileProcess: (req: ProcessFileRequest, content: string, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<BuildFileResponse>;
630
+ fileProcess: (req: ProcessFileRequest, content: FileImportExportContent, client: Crowdin, context: CrowdinContextInfo, projectId: number) => Promise<ContentFileResponse>;
630
631
  }
631
632
  export interface SignaturePatterns {
632
633
  fileName?: string;
@@ -639,7 +640,7 @@ export interface ProcessFileRequest {
639
640
  targetLanguages: LanguagesModel.Language[];
640
641
  strings: ProcessFileString[];
641
642
  stringsUrl: string;
642
- getRawContent?: (encoding: BufferEncoding) => Promise<string>;
643
+ getRawContent?: (encoding: BufferEncoding) => Promise<string | Buffer>;
643
644
  }
644
645
  export interface ProcessFileRecord {
645
646
  content?: string;
@@ -657,17 +658,22 @@ export declare enum ProcessFileJobType {
657
658
  POST_EXPORT = "post-export-file"
658
659
  }
659
660
  export interface ParseFileResponse {
660
- previewFile?: string;
661
+ previewFile?: Buffer;
661
662
  strings?: ProcessFileString[];
662
663
  error?: string;
663
664
  }
664
665
  export interface BuildFileResponse {
665
- contentFile: string;
666
- base64EncodedContent?: string;
666
+ contentFile: Buffer;
667
667
  error?: string;
668
668
  fileName?: string;
669
669
  fileType?: string;
670
670
  }
671
+ export interface StringsFileResponse extends Omit<ParseFileResponse, 'previewFile'> {
672
+ notModified?: boolean;
673
+ }
674
+ export interface ContentFileResponse extends BuildFileResponse {
675
+ notModified?: boolean;
676
+ }
671
677
  export interface ProcessFileString {
672
678
  previewId?: number;
673
679
  id: number;
@@ -827,6 +833,13 @@ export interface IntegrationFilesSnapshot {
827
833
  crowdinId: string;
828
834
  provider: Provider;
829
835
  }
836
+ export interface IntegrationWebhooks {
837
+ id: number;
838
+ fileId: number;
839
+ integrationId: string;
840
+ crowdinId: string;
841
+ provider: Provider;
842
+ }
830
843
  export interface ImagePath {
831
844
  /**
832
845
  * path to app logo (e.g. {@example join(__dirname, 'logo.png')})
@@ -869,10 +882,10 @@ export interface Webhooks {
869
882
  crowdinWebhookUrl?: string;
870
883
  integrationWebhookUrl?: string;
871
884
  urlParam?: string;
872
- crowdinWebhooks?: (client: Crowdin, projectId: number, available: boolean, config?: any) => Promise<void>;
873
- integrationWebhooks?: (apiCredentials: any, urlParam: string, available: boolean, config?: any, syncSettings?: any) => Promise<void>;
885
+ crowdinWebhooks?: (client: Crowdin, projectId: number, available: boolean, config?: AppSettings) => Promise<void>;
886
+ integrationWebhooks?: (apiCredentials: any, urlParam: string, available: boolean, config?: AppSettings, syncSettings?: any) => Promise<void>;
874
887
  crowdinWebhookInterceptor?: (projectId: number, client: Crowdin, appRootFolder?: SourceFilesModel.Directory, config?: any, syncSettings?: any, webhookRequest?: any) => Promise<UpdateIntegrationRequest>;
875
- integrationWebhookInterceptor?: (projectId: number, client: Crowdin, apiCredentials: any, appRootFolder?: SourceFilesModel.Directory, config?: any, syncSettings?: any, webhookRequest?: any) => Promise<IntegrationFile[]>;
888
+ integrationWebhookInterceptor?: (projectId: number, client: Crowdin, apiCredentials: any, appRootFolder?: SourceFilesModel.Directory, config?: AppSettings, syncSettings?: any, webhookRequest?: any) => Promise<IntegrationFile[]>;
876
889
  queueUrl: string;
877
890
  }
878
891
  export declare enum SyncCondition {
@@ -880,10 +893,9 @@ export declare enum SyncCondition {
880
893
  TRANSLATED = 1,
881
894
  APPROVED = 2
882
895
  }
883
- export declare enum SyncType {
884
- NONE = 0,
885
- SCHEDULE = 1,
886
- WEBHOOKS = 2
896
+ export declare enum SyncSchedule {
897
+ DISABLED = 0,
898
+ ACTIVE
887
899
  }
888
900
  export type Payload = {
889
901
  event: string;
@@ -912,6 +924,20 @@ export interface UpdateCrowdinWebhookPayloadsArgs {
912
924
  webhookData: any;
913
925
  req: Request;
914
926
  }
927
+ export interface FilterSyncFilesArgs {
928
+ projectId: number;
929
+ crowdinClient: Crowdin;
930
+ events: Payload[];
931
+ syncFileSettings: UpdateIntegrationRequest;
932
+ appSettings: AppSettings;
933
+ }
934
+ export interface AppSettings {
935
+ schedule?: number;
936
+ condition?: number;
937
+ 'new-crowdin-files'?: boolean;
938
+ 'new-integration-files'?: boolean;
939
+ [key: string]: any;
940
+ }
915
941
  export declare enum UserPermissions {
916
942
  OWNER = "owner",
917
943
  MANAGERS = "managers",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProjectPermissions = exports.UserPermissions = exports.SyncType = exports.SyncCondition = exports.RequestMethods = exports.Provider = exports.ContextOptionsTypes = exports.ContextOptionsLocations = exports.EditorPanelsMode = exports.ProcessFileJobType = exports.SubscriptionInfoType = exports.AccountType = exports.Scope = exports.AuthenticationType = void 0;
3
+ exports.ProjectPermissions = exports.UserPermissions = exports.SyncSchedule = exports.SyncCondition = exports.RequestMethods = exports.Provider = exports.ContextOptionsTypes = exports.ContextOptionsLocations = exports.EditorPanelsMode = exports.ProcessFileJobType = exports.SubscriptionInfoType = exports.AccountType = exports.Scope = exports.AuthenticationType = void 0;
4
4
  var AuthenticationType;
5
5
  (function (AuthenticationType) {
6
6
  AuthenticationType["CODE"] = "authorization_code";
@@ -85,12 +85,11 @@ var SyncCondition;
85
85
  SyncCondition[SyncCondition["TRANSLATED"] = 1] = "TRANSLATED";
86
86
  SyncCondition[SyncCondition["APPROVED"] = 2] = "APPROVED";
87
87
  })(SyncCondition = exports.SyncCondition || (exports.SyncCondition = {}));
88
- var SyncType;
89
- (function (SyncType) {
90
- SyncType[SyncType["NONE"] = 0] = "NONE";
91
- SyncType[SyncType["SCHEDULE"] = 1] = "SCHEDULE";
92
- SyncType[SyncType["WEBHOOKS"] = 2] = "WEBHOOKS";
93
- })(SyncType = exports.SyncType || (exports.SyncType = {}));
88
+ var SyncSchedule;
89
+ (function (SyncSchedule) {
90
+ SyncSchedule[SyncSchedule["DISABLED"] = 0] = "DISABLED";
91
+ SyncSchedule[SyncSchedule["ACTIVE"] = 1 || 3 || 6 || 12 || 24] = "ACTIVE";
92
+ })(SyncSchedule = exports.SyncSchedule || (exports.SyncSchedule = {}));
94
93
  var UserPermissions;
95
94
  (function (UserPermissions) {
96
95
  UserPermissions["OWNER"] = "owner";