@crowdin/app-project-module 0.108.0 → 1.0.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.
Files changed (202) hide show
  1. package/out/app-test/integration/get-integration-files.js +16 -4
  2. package/out/app-test/integration/types.d.ts +1 -1
  3. package/out/app-test/integration/update-crowdin.js +2 -2
  4. package/out/app-test/integration/update-integration.js +2 -2
  5. package/out/index.d.ts +2 -1
  6. package/out/index.js +73 -30
  7. package/out/middlewares/auto-credentials-masker.d.ts +4 -0
  8. package/out/middlewares/auto-credentials-masker.js +45 -0
  9. package/out/middlewares/crowdin-client.d.ts +1 -1
  10. package/out/middlewares/integration-credentials.d.ts +2 -2
  11. package/out/middlewares/integration-credentials.js +7 -4
  12. package/out/middlewares/render-ui-module.d.ts +3 -3
  13. package/out/middlewares/render-ui-module.js +10 -13
  14. package/out/middlewares/ui-module.d.ts +1 -1
  15. package/out/middlewares/ui-module.js +11 -1
  16. package/out/modules/about.d.ts +2 -1
  17. package/out/modules/about.js +10 -3
  18. package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
  19. package/out/modules/ai-prompt-provider/handlers/compile.js +7 -1
  20. package/out/modules/ai-prompt-provider/index.js +2 -2
  21. package/out/modules/ai-prompt-provider/types.d.ts +7 -1
  22. package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
  23. package/out/modules/ai-provider/handlers/chat-completions.js +1 -1
  24. package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
  25. package/out/modules/ai-provider/index.js +2 -2
  26. package/out/modules/ai-provider/types.d.ts +4 -4
  27. package/out/modules/ai-request-processors/handler.d.ts +1 -1
  28. package/out/modules/ai-request-processors/handler.js +12 -2
  29. package/out/modules/ai-request-processors/types.d.ts +12 -2
  30. package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
  31. package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
  32. package/out/modules/ai-tools/index.js +1 -1
  33. package/out/modules/ai-tools/types.d.ts +1 -1
  34. package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
  35. package/out/modules/auth-guard/index.js +1 -1
  36. package/out/modules/automation-action/handlers/execute.d.ts +1 -1
  37. package/out/modules/automation-action/handlers/execute.js +1 -1
  38. package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
  39. package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
  40. package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
  41. package/out/modules/automation-action/handlers/validate-settings.js +1 -1
  42. package/out/modules/automation-action/index.js +1 -1
  43. package/out/modules/automation-action/types.d.ts +4 -4
  44. package/out/modules/automation-action/util/index.js +2 -5
  45. package/out/modules/context-menu/index.js +2 -2
  46. package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
  47. package/out/modules/custom-mt/handlers/translate.js +25 -9
  48. package/out/modules/custom-mt/index.js +3 -3
  49. package/out/modules/custom-mt/types.d.ts +10 -2
  50. package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
  51. package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
  52. package/out/modules/custom-spell-check/index.js +4 -4
  53. package/out/modules/editor-right-panel/index.js +1 -1
  54. package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
  55. package/out/modules/external-qa-check/index.js +2 -2
  56. package/out/modules/file-processing/handlers/custom-file-format.d.ts +7 -2
  57. package/out/modules/file-processing/handlers/custom-file-format.js +62 -22
  58. package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
  59. package/out/modules/file-processing/handlers/file-download.js +5 -0
  60. package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
  61. package/out/modules/file-processing/handlers/pre-post-process.js +41 -15
  62. package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
  63. package/out/modules/file-processing/handlers/translations-alignment.js +10 -4
  64. package/out/modules/file-processing/index.js +12 -2
  65. package/out/modules/file-processing/types.d.ts +36 -5
  66. package/out/modules/file-processing/util/defaults.js +50 -6
  67. package/out/modules/file-processing/util/files.js +2 -1
  68. package/out/modules/form-data-display.d.ts +1 -1
  69. package/out/modules/form-data-save.d.ts +1 -1
  70. package/out/modules/install.d.ts +1 -1
  71. package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
  72. package/out/modules/integration/handlers/crowdin-file-progress.js +5 -1
  73. package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +5 -0
  74. package/out/modules/integration/handlers/crowdin-files-target-languages.js +103 -0
  75. package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
  76. package/out/modules/integration/handlers/crowdin-files.js +7 -1
  77. package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
  78. package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
  79. package/out/modules/integration/handlers/crowdin-update.js +59 -18
  80. package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
  81. package/out/modules/integration/handlers/crowdin-webhook.js +15 -8
  82. package/out/modules/integration/handlers/integration-data.d.ts +1 -1
  83. package/out/modules/integration/handlers/integration-data.js +13 -6
  84. package/out/modules/integration/handlers/integration-login.d.ts +1 -1
  85. package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
  86. package/out/modules/integration/handlers/integration-logout.js +8 -3
  87. package/out/modules/integration/handlers/integration-update.d.ts +1 -1
  88. package/out/modules/integration/handlers/integration-update.js +44 -6
  89. package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
  90. package/out/modules/integration/handlers/invite-users.d.ts +1 -1
  91. package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
  92. package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -1
  93. package/out/modules/integration/handlers/job-info-deprecated.js +3 -2
  94. package/out/modules/integration/handlers/job-info.d.ts +1 -1
  95. package/out/modules/integration/handlers/job-list.d.ts +1 -1
  96. package/out/modules/integration/handlers/main.d.ts +1 -1
  97. package/out/modules/integration/handlers/main.js +32 -2
  98. package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
  99. package/out/modules/integration/handlers/oauth-login.js +28 -6
  100. package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
  101. package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
  102. package/out/modules/integration/handlers/settings-save.d.ts +1 -1
  103. package/out/modules/integration/handlers/settings-save.js +9 -9
  104. package/out/modules/integration/handlers/settings.d.ts +1 -1
  105. package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
  106. package/out/modules/integration/handlers/sync-settings-save.js +5 -9
  107. package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
  108. package/out/modules/integration/handlers/user-errors.d.ts +1 -1
  109. package/out/modules/integration/handlers/users.d.ts +1 -1
  110. package/out/modules/integration/index.js +19 -33
  111. package/out/modules/integration/types.d.ts +133 -29
  112. package/out/modules/integration/types.js +1 -0
  113. package/out/modules/integration/util/cron.d.ts +2 -2
  114. package/out/modules/integration/util/cron.js +40 -24
  115. package/out/modules/integration/util/defaults.d.ts +4 -0
  116. package/out/modules/integration/util/defaults.js +175 -15
  117. package/out/modules/integration/util/files.d.ts +2 -1
  118. package/out/modules/integration/util/files.js +19 -8
  119. package/out/modules/integration/util/job.js +4 -3
  120. package/out/modules/integration/util/snapshot.js +19 -3
  121. package/out/modules/integration/util/types.d.ts +1 -0
  122. package/out/modules/integration/util/types.js +1 -0
  123. package/out/modules/integration/util/webhooks.d.ts +8 -8
  124. package/out/modules/integration/util/webhooks.js +34 -17
  125. package/out/modules/manifest.js +12 -12
  126. package/out/modules/modal/index.js +2 -2
  127. package/out/modules/organization-menu/index.js +5 -4
  128. package/out/modules/organization-settings-menu/index.js +5 -4
  129. package/out/modules/profile-resources-menu/index.js +5 -4
  130. package/out/modules/profile-settings-menu/index.js +5 -4
  131. package/out/modules/project-menu/index.js +1 -1
  132. package/out/modules/project-menu-crowdsource/index.js +1 -1
  133. package/out/modules/project-reports/index.js +3 -2
  134. package/out/modules/project-tools/index.js +3 -2
  135. package/out/modules/status.d.ts +1 -1
  136. package/out/modules/status.js +12 -3
  137. package/out/modules/subscription-paid.d.ts +1 -1
  138. package/out/modules/uninstall.d.ts +1 -1
  139. package/out/modules/uninstall.js +1 -1
  140. package/out/modules/webhooks/handlers/webhook-handler.d.ts +2 -2
  141. package/out/modules/webhooks/handlers/webhook-handler.js +33 -22
  142. package/out/modules/webhooks/types.d.ts +7 -0
  143. package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
  144. package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
  145. package/out/modules/workflow-step-type/index.js +2 -2
  146. package/out/modules/workflow-step-type/util/index.js +3 -6
  147. package/out/static/js/dependent.js +16 -7
  148. package/out/static/ui/error.bundle.js +474 -0
  149. package/out/static/ui/error.bundle.js.map +1 -0
  150. package/out/static/ui/install.bundle.js +459 -0
  151. package/out/static/ui/install.bundle.js.map +1 -0
  152. package/out/static/ui/login.bundle.js +630 -0
  153. package/out/static/ui/login.bundle.js.map +1 -0
  154. package/out/static/ui/main.bundle.js +2109 -0
  155. package/out/static/ui/main.bundle.js.map +1 -0
  156. package/out/static/ui/oauth.bundle.js +467 -0
  157. package/out/static/ui/oauth.bundle.js.map +1 -0
  158. package/out/storage/d1.d.ts +107 -0
  159. package/out/storage/d1.js +831 -0
  160. package/out/storage/index.js +8 -1
  161. package/out/storage/mysql.js +22 -19
  162. package/out/storage/postgre.d.ts +0 -1
  163. package/out/storage/postgre.js +20 -30
  164. package/out/storage/sqlite.d.ts +2 -5
  165. package/out/storage/sqlite.js +29 -69
  166. package/out/types.d.ts +78 -18
  167. package/out/util/connection.js +1 -1
  168. package/out/util/credentials-masker.d.ts +3 -3
  169. package/out/util/credentials-masker.js +14 -20
  170. package/out/util/cron.d.ts +29 -0
  171. package/out/util/cron.js +87 -0
  172. package/out/util/index.d.ts +14 -1
  173. package/out/util/index.js +121 -10
  174. package/out/util/jsx-renderer.d.ts +14 -0
  175. package/out/util/jsx-renderer.js +35 -0
  176. package/out/util/logger.d.ts +1 -0
  177. package/out/util/logger.js +2 -2
  178. package/out/util/static-files.d.ts +19 -0
  179. package/out/util/static-files.js +87 -0
  180. package/out/util/subscription.js +1 -1
  181. package/out/views/AboutPage.d.ts +10 -0
  182. package/out/views/AboutPage.js +76 -0
  183. package/out/views/FormPage.d.ts +14 -0
  184. package/out/views/FormPage.js +28 -0
  185. package/out/views/SubscriptionPage.d.ts +7 -0
  186. package/out/views/SubscriptionPage.js +26 -0
  187. package/out/views/index.d.ts +8 -0
  188. package/out/views/index.js +15 -0
  189. package/out/views/layout/Head.d.ts +9 -0
  190. package/out/views/layout/Head.js +54 -0
  191. package/package.json +43 -41
  192. package/out/util/handlebars.d.ts +0 -1
  193. package/out/util/handlebars.js +0 -46
  194. package/out/views/about.handlebars +0 -102
  195. package/out/views/error.handlebars +0 -54
  196. package/out/views/form.handlebars +0 -31
  197. package/out/views/install.handlebars +0 -16
  198. package/out/views/login.handlebars +0 -332
  199. package/out/views/main.handlebars +0 -2042
  200. package/out/views/oauth.handlebars +0 -11
  201. package/out/views/partials/head.handlebars +0 -53
  202. package/out/views/subscription.handlebars +0 -26
@@ -1,7 +1,8 @@
1
1
  import Crowdin, { SourceFilesModel, TranslationStatusModel } from '@crowdin/crowdin-api-client';
2
2
  import { Request } from 'express';
3
3
  import { CrowdinClientRequest, ModuleKey } from '../../types';
4
- import { JobClient, JobStoreType } from './util/types';
4
+ import { IntegrationSyncedData, JobClient, JobStoreType } from './util/types';
5
+ import { AppModuleError, AppUserModuleError } from '../../util/logger';
5
6
  export interface IntegrationLogic extends ModuleKey {
6
7
  /**
7
8
  * Customize your app login form
@@ -22,35 +23,61 @@ export interface IntegrationLogic extends ModuleKey {
22
23
  /**
23
24
  * Validate integration settings before saving
24
25
  */
25
- validateSettings?: ({ client, credentials, appSettings, }: {
26
+ validateSettings?: ({ client, credentials, settings, }: {
26
27
  client: Crowdin;
27
28
  credentials: any;
28
- appSettings: AppSettings;
29
+ settings: any;
29
30
  }) => Promise<{
30
31
  [key: string]: string;
31
32
  } | null>;
32
33
  /**
33
34
  * function which will be used to check connection with integration service
34
35
  */
35
- checkConnection?: (apiCredentials: any) => Promise<void>;
36
+ checkConnection?: (credentials: any) => Promise<void>;
36
37
  /**
37
38
  * function to get crowdin files that are related with this integration
38
39
  */
39
- getCrowdinFiles?: (projectId: number, client: Crowdin, appRootFolder?: SourceFilesModel.Directory, config?: any, mode?: CrowdinFilesLoadMode) => Promise<TreeItem[]>;
40
+ getCrowdinFiles?: (options: {
41
+ projectId: number;
42
+ client: Crowdin;
43
+ rootFolder?: SourceFilesModel.Directory;
44
+ settings?: any;
45
+ mode?: CrowdinFilesLoadMode;
46
+ }) => Promise<TreeItem[]>;
47
+ /**
48
+ * Match Crowdin files to integration files or vice versa.
49
+ */
50
+ matchCrowdinFilesToIntegrationFiles?: ({ projectId, client, credentials, crowdinFiles, integrationFiles, settings, rootFolder, syncedData, }: {
51
+ projectId: number;
52
+ client: Crowdin;
53
+ credentials: any;
54
+ crowdinFiles?: UpdateIntegrationRequest;
55
+ integrationFiles?: IntegrationFile[];
56
+ settings?: any;
57
+ rootFolder?: SourceFilesModel.Directory;
58
+ syncedData?: IntegrationSyncedData | undefined;
59
+ }) => Promise<IntegrationFile[] | UpdateIntegrationRequest | MatchingResult<IntegrationFile[] | UpdateIntegrationRequest>>;
40
60
  /**
41
61
  * function to get data from integration
42
62
  */
43
- getIntegrationFiles: (apiCredentials: any, config?: any, parentId?: any, search?: any, page?: any, paginationData?: any) => Promise<TreeItem[] | ExtendedResult<TreeItem[]>>;
63
+ getIntegrationFiles: (options: {
64
+ credentials: any;
65
+ settings?: any;
66
+ parentId?: any;
67
+ search?: any;
68
+ page?: any;
69
+ paginationData?: any;
70
+ }) => Promise<TreeItem[] | ExtendedResult<TreeItem[]>>;
44
71
  /**
45
72
  * function to update crowdin files (e.g. pull integration data to crowdin source files)
46
73
  */
47
- updateCrowdin: ({ projectId, client, credentials, request, rootFolder, appSettings, uploadTranslations, job, excludedTargetLanguages, }: {
74
+ updateCrowdin: ({ projectId, client, credentials, request, rootFolder, settings, uploadTranslations, job, excludedTargetLanguages, }: {
48
75
  projectId: number;
49
76
  client: Crowdin;
50
77
  credentials: any;
51
78
  request: IntegrationFile[];
52
79
  rootFolder?: SourceFilesModel.Directory;
53
- appSettings?: any;
80
+ settings?: any;
54
81
  uploadTranslations?: boolean;
55
82
  job: JobClient;
56
83
  excludedTargetLanguages?: string[];
@@ -58,13 +85,13 @@ export interface IntegrationLogic extends ModuleKey {
58
85
  /**
59
86
  * function to update integration content (e.g. load crowdin translations and push them to integration service)
60
87
  */
61
- updateIntegration: ({ projectId, client, credentials, request, rootFolder, appSettings, job, }: {
88
+ updateIntegration: ({ projectId, client, credentials, request, rootFolder, settings, job, }: {
62
89
  projectId: number;
63
90
  client: Crowdin;
64
91
  credentials: any;
65
92
  request: UpdateIntegrationRequest;
66
93
  rootFolder?: SourceFilesModel.Directory;
67
- appSettings?: any;
94
+ settings?: any;
68
95
  job: JobClient;
69
96
  }) => Promise<void | ExtendedResult<void>>;
70
97
  /**
@@ -74,19 +101,30 @@ export interface IntegrationLogic extends ModuleKey {
74
101
  /**
75
102
  * function to define configuration(settings) modal for you app (by default app will not have any custom settings)
76
103
  */
77
- getConfiguration?: (projectId: number, client: Crowdin, apiCredentials: any) => Promise<FormEntity[]>;
104
+ getConfiguration?: (options: {
105
+ projectId: number;
106
+ client: Crowdin;
107
+ credentials: any;
108
+ settings: any;
109
+ clientId: string;
110
+ }) => Promise<FormEntity[]>;
78
111
  /**
79
112
  * function to normalize saved settings
80
113
  */
81
- normalizeSettings?: ({ appSettings, apiCredentials, client, }: {
82
- appSettings: FormEntity[];
83
- apiCredentials: any;
114
+ normalizeSettings?: ({ settings, credentials, client, }: {
115
+ settings: FormEntity[];
116
+ credentials: any;
84
117
  client?: Crowdin;
85
118
  }) => Promise<FormEntity[]>;
86
119
  /**
87
120
  * Logout hook for cleanup logic
88
121
  */
89
- onLogout?: (projectId: number, client: Crowdin, apiCredentials: any, config?: any) => Promise<void>;
122
+ onLogout?: (options: {
123
+ projectId: number;
124
+ client: Crowdin;
125
+ credentials: any;
126
+ settings?: any;
127
+ }) => Promise<void>;
90
128
  /**
91
129
  * flag to turn on auto reload of the tree whenever user updates the configuration
92
130
  */
@@ -184,6 +222,15 @@ export interface IntegrationLogic extends ModuleKey {
184
222
  * Enable the option to upload file for translation into selected languages.
185
223
  */
186
224
  excludedTargetLanguages?: boolean;
225
+ /**
226
+ * function to update target languages for existing Crowdin files.
227
+ */
228
+ updateFilesTargetLanguages?: ({ projectId, client, fileIds, excludedTargetLanguages, }: {
229
+ projectId: number;
230
+ client: Crowdin;
231
+ fileIds: number[];
232
+ excludedTargetLanguages: string[];
233
+ }) => Promise<void>;
187
234
  /**
188
235
  * Enable the option to add 'Exclude paths' and 'Include paths' text fields to integration settings
189
236
  */
@@ -191,7 +238,11 @@ export interface IntegrationLogic extends ModuleKey {
191
238
  /**
192
239
  * function to get crowdin file translation progress
193
240
  */
194
- getFileProgress?: (projectId: number, client: Crowdin, fileId: number) => Promise<{
241
+ getFileProgress?: (options: {
242
+ projectId: number;
243
+ client: Crowdin;
244
+ fileId: number;
245
+ }) => Promise<{
195
246
  [key: number]: TranslationStatusModel.LanguageProgress[];
196
247
  }>;
197
248
  /**
@@ -264,7 +315,10 @@ export interface OAuthLogin {
264
315
  /**
265
316
  * Authorization url getter
266
317
  */
267
- getAuthorizationUrl?: (redirectUrl: string, loginForm: any) => string;
318
+ getAuthorizationUrl?: (options: {
319
+ redirectUrl: string;
320
+ loginForm: any;
321
+ }) => string;
268
322
  /**
269
323
  * Access token url (e.g. https://github.com/login/oauth/access_token)
270
324
  */
@@ -356,13 +410,22 @@ export interface OAuthLogin {
356
410
  /**
357
411
  * Override to implement request for retrieving access token (and refresh token if 'refresh' is enabled)
358
412
  */
359
- performGetTokenRequest?: (code: string, query: {
360
- [key: string]: any;
361
- }, url: string, redirectUri: string, loginForm?: any) => Promise<any>;
413
+ performGetTokenRequest?: (options: {
414
+ code: string;
415
+ query: {
416
+ [key: string]: any;
417
+ };
418
+ url: string;
419
+ redirectUri: string;
420
+ loginForm?: any;
421
+ }) => Promise<any>;
362
422
  /**
363
423
  * Override to implement request for refreshing token (only if 'refresh' is enabled)
364
424
  */
365
- performRefreshTokenRequest?: (currentCredentials: any, loginForm?: any) => Promise<any>;
425
+ performRefreshTokenRequest?: (options: {
426
+ credentials: any;
427
+ loginForm?: any;
428
+ }) => Promise<any>;
366
429
  }
367
430
  export type CrowdinFilesLoadMode = 'directories' | 'files';
368
431
  export interface BaseTreeItem {
@@ -461,12 +524,22 @@ export interface IntegrationFile {
461
524
  export interface UpdateIntegrationRequest {
462
525
  [fileId: string]: string[];
463
526
  }
527
+ export interface UpdateTargetLanguagesRequest {
528
+ fileIds: number[];
529
+ languages: string[];
530
+ }
464
531
  export interface IntegrationRequest extends CrowdinClientRequest {
465
532
  integrationCredentials: any;
466
533
  integrationSettings?: any;
467
534
  }
468
535
  export interface CronJob {
469
- task: (projectId: number, client: Crowdin, apiCredentials: any, appRootFolder?: SourceFilesModel.Directory, config?: any) => Promise<void>;
536
+ task: (options: {
537
+ projectId: number;
538
+ client: Crowdin;
539
+ credentials: any;
540
+ rootFolder?: SourceFilesModel.Directory;
541
+ settings?: any;
542
+ }) => Promise<void>;
470
543
  expression: string;
471
544
  }
472
545
  export interface ExtendedResult<T> {
@@ -474,6 +547,10 @@ export interface ExtendedResult<T> {
474
547
  message?: string;
475
548
  stopPagination?: boolean;
476
549
  }
550
+ export interface MatchingResult<T> {
551
+ data: T;
552
+ errors?: Error[] | AppModuleError[] | AppUserModuleError[];
553
+ }
477
554
  type LabelTreeElementType = 'primary' | 'secondary' | 'success' | 'warning' | 'info' | 'danger' | 'dark' | 'light';
478
555
  export interface LabelTreeElement {
479
556
  text: string;
@@ -514,10 +591,36 @@ export interface Webhooks {
514
591
  crowdinWebhookUrl?: string;
515
592
  integrationWebhookUrl?: string;
516
593
  urlParam?: string;
517
- crowdinWebhooks?: (client: Crowdin, projectId: number, available: boolean, config?: AppSettings) => Promise<void>;
518
- integrationWebhooks?: (apiCredentials: any, urlParam: string, available: boolean, config?: AppSettings, syncSettings?: any) => Promise<void>;
519
- crowdinWebhookInterceptor?: (projectId: number, client: Crowdin, appRootFolder?: SourceFilesModel.Directory, config?: any, syncSettings?: any, webhookRequest?: any) => Promise<UpdateIntegrationRequest>;
520
- integrationWebhookInterceptor?: (projectId: number, client: Crowdin, apiCredentials: any, appRootFolder?: SourceFilesModel.Directory, config?: AppSettings, syncSettings?: any, webhookRequests?: any) => Promise<IntegrationFile[]>;
594
+ crowdinWebhooks?: (options: {
595
+ client: Crowdin;
596
+ projectId: number;
597
+ available: boolean;
598
+ settings?: AppSettings;
599
+ }) => Promise<void>;
600
+ integrationWebhooks?: (options: {
601
+ credentials: any;
602
+ urlParam: string;
603
+ available: boolean;
604
+ settings?: AppSettings;
605
+ syncSettings?: any;
606
+ }) => Promise<void>;
607
+ crowdinWebhookInterceptor?: (options: {
608
+ projectId: number;
609
+ client: Crowdin;
610
+ rootFolder?: SourceFilesModel.Directory;
611
+ settings?: any;
612
+ syncSettings?: any;
613
+ webhookRequest?: any;
614
+ }) => Promise<UpdateIntegrationRequest>;
615
+ integrationWebhookInterceptor?: (options: {
616
+ projectId: number;
617
+ client: Crowdin;
618
+ credentials: any;
619
+ rootFolder?: SourceFilesModel.Directory;
620
+ settings?: AppSettings;
621
+ syncSettings?: any;
622
+ webhookRequests?: any;
623
+ }) => Promise<IntegrationFile[]>;
521
624
  queueUrl: string;
522
625
  }
523
626
  export declare enum SyncCondition {
@@ -547,10 +650,10 @@ export interface UpdateCrowdinWebhookPayloadsArgs {
547
650
  }
548
651
  export interface FilterSyncFilesArgs {
549
652
  projectId: number;
550
- crowdinClient: Crowdin;
653
+ client: Crowdin;
551
654
  events: Payload[];
552
655
  syncFileSettings: UpdateIntegrationRequest;
553
- appSettings: AppSettings;
656
+ settings: AppSettings;
554
657
  }
555
658
  export interface AppSettings {
556
659
  schedule?: number;
@@ -566,6 +669,7 @@ interface LoginFormTokenResponse {
566
669
  }
567
670
  export declare enum DefaultCategory {
568
671
  GENERAL = "General Settings",
569
- SYNC = "Sync settings"
672
+ SYNC = "Sync settings",
673
+ ADVANCED = "Advanced"
570
674
  }
571
675
  export {};
@@ -21,4 +21,5 @@ var DefaultCategory;
21
21
  (function (DefaultCategory) {
22
22
  DefaultCategory["GENERAL"] = "General Settings";
23
23
  DefaultCategory["SYNC"] = "Sync settings";
24
+ DefaultCategory["ADVANCED"] = "Advanced";
24
25
  })(DefaultCategory = exports.DefaultCategory || (exports.DefaultCategory = {}));
@@ -7,7 +7,7 @@ export declare function runJob({ config, integration, job, }: {
7
7
  integration: IntegrationLogic;
8
8
  job: CronJob;
9
9
  }): Promise<void>;
10
- export declare function runUpdateProviderJob({ integrationId, crowdinId, type, title, payload, jobType, projectId, client, integration, context, credentials, rootFolder, appSettings, reRunJobId, }: {
10
+ export declare function runUpdateProviderJob({ integrationId, crowdinId, type, title, payload, jobType, projectId, client, integration, context, credentials, rootFolder, settings, reRunJobId, }: {
11
11
  integrationId: string;
12
12
  crowdinId: string;
13
13
  type: JobType;
@@ -20,7 +20,7 @@ export declare function runUpdateProviderJob({ integrationId, crowdinId, type, t
20
20
  context: CrowdinContextInfo;
21
21
  credentials: any;
22
22
  rootFolder?: SourceFilesModel.Directory;
23
- appSettings?: any;
23
+ settings?: any;
24
24
  reRunJobId?: string;
25
25
  }): Promise<void>;
26
26
  export declare function filesCron({ config, integration, period, }: {
@@ -69,11 +69,17 @@ function runJob({ config, integration, job, }) {
69
69
  for (const integrationCredentials of integrationCredentialsList) {
70
70
  const integrationConfig = allIntegrationConfigs.find(({ integrationId }) => integrationId === integrationCredentials.id);
71
71
  const projectId = crowdinAppFunctions.getProjectId(integrationCredentials.id);
72
- const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
72
+ const credentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
73
73
  const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, crowdinClient, projectId);
74
74
  const intConfig = (integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.config) ? JSON.parse(integrationConfig.config) : undefined;
75
75
  (0, logger_1.log)(`Executing task for cron job with expression [${job.expression}] for project ${projectId}`);
76
- yield job.task(projectId, crowdinClient, apiCredentials, rootFolder, intConfig);
76
+ yield job.task({
77
+ projectId,
78
+ client: crowdinClient,
79
+ credentials,
80
+ rootFolder,
81
+ settings: intConfig,
82
+ });
77
83
  (0, logger_1.log)(`Task for cron job with expression [${job.expression}] for project ${projectId} completed`);
78
84
  }
79
85
  })));
@@ -81,7 +87,7 @@ function runJob({ config, integration, job, }) {
81
87
  });
82
88
  }
83
89
  exports.runJob = runJob;
84
- function runUpdateProviderJob({ integrationId, crowdinId, type, title, payload, jobType, projectId, client, integration, context, credentials, rootFolder, appSettings, reRunJobId, }) {
90
+ function runUpdateProviderJob({ integrationId, crowdinId, type, title, payload, jobType, projectId, client, integration, context, credentials, rootFolder, settings, reRunJobId, }) {
85
91
  return __awaiter(this, void 0, void 0, function* () {
86
92
  try {
87
93
  yield (0, job_1.runAsJob)({
@@ -96,17 +102,16 @@ function runUpdateProviderJob({ integrationId, crowdinId, type, title, payload,
96
102
  reRunJobId,
97
103
  jobStoreType: integration.jobStoreType,
98
104
  jobCallback: (job) => __awaiter(this, void 0, void 0, function* () {
99
- const updateParams = {
100
- projectId,
101
- client,
102
- credentials,
103
- request: payload,
104
- rootFolder,
105
- appSettings,
106
- job,
107
- };
108
105
  if (type === types_2.JobType.UPDATE_TO_CROWDIN) {
109
- yield integration.updateCrowdin(updateParams);
106
+ yield integration.updateCrowdin({
107
+ projectId,
108
+ client,
109
+ credentials,
110
+ request: payload,
111
+ rootFolder,
112
+ settings,
113
+ job,
114
+ });
110
115
  try {
111
116
  yield (0, files_1.updateSyncedData)(integrationId, crowdinId, payload, types_1.Provider.INTEGRATION);
112
117
  }
@@ -115,7 +120,15 @@ function runUpdateProviderJob({ integrationId, crowdinId, type, title, payload,
115
120
  }
116
121
  }
117
122
  else if (type === types_2.JobType.UPDATE_TO_INTEGRATION) {
118
- yield integration.updateIntegration(updateParams);
123
+ yield integration.updateIntegration({
124
+ projectId,
125
+ client,
126
+ credentials,
127
+ request: payload,
128
+ rootFolder,
129
+ settings,
130
+ job,
131
+ });
119
132
  }
120
133
  }),
121
134
  });
@@ -219,7 +232,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
219
232
  }
220
233
  context.jwtPayload.context.project_identifier = projectData.identifier;
221
234
  const rootFolder = yield (0, defaults_1.getRootFolder)(config, integration, crowdinClient, projectId);
222
- const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
235
+ const credentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
223
236
  let currentFileSnapshot = [];
224
237
  const needsSnapshotForNewFiles = !integration.webhooks &&
225
238
  ((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[syncSettings.provider]) &&
@@ -227,7 +240,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
227
240
  const needsIntegrationSnapshot = needsSnapshotForNewFiles && syncSettings.provider !== types_1.Provider.CROWDIN;
228
241
  const needsCrowdinSnapshot = needsSnapshotForNewFiles && syncSettings.provider === types_1.Provider.CROWDIN;
229
242
  if (needsIntegrationSnapshot) {
230
- currentFileSnapshot = yield (0, snapshot_1.getIntegrationSnapshot)(integration, apiCredentials, intConfig);
243
+ currentFileSnapshot = yield (0, snapshot_1.getIntegrationSnapshot)(integration, credentials, intConfig);
231
244
  }
232
245
  else if (needsCrowdinSnapshot) {
233
246
  currentFileSnapshot = yield (0, snapshot_1.getCrowdinSnapshot)(config, integration, crowdinClient, projectData.id, intConfig);
@@ -311,7 +324,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
311
324
  return;
312
325
  }
313
326
  }
314
- const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
327
+ const credentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
315
328
  if (!(intConfig === null || intConfig === void 0 ? void 0 : intConfig.inContext)) {
316
329
  removeInContextLanguage(filesToProcess, projectData);
317
330
  }
@@ -327,9 +340,9 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
327
340
  client: crowdinClient,
328
341
  integration,
329
342
  context,
330
- credentials: apiCredentials,
343
+ credentials,
331
344
  rootFolder,
332
- appSettings: intConfig,
345
+ settings: intConfig,
333
346
  });
334
347
  }
335
348
  catch (e) {
@@ -361,12 +374,15 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
361
374
  return;
362
375
  }
363
376
  (0, logger_1.log)(`Executing updateCrowdin task for files cron job with period [${period}] for project ${projectId}. Files ${intFiles.length}`);
364
- const apiCredentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
377
+ const credentials = yield (0, connection_1.prepareIntegrationCredentials)(config, integration, integrationCredentials);
365
378
  if (integration.filterByPathIntegrationFiles) {
366
379
  const includePatterns = (_b = intConfig === null || intConfig === void 0 ? void 0 : intConfig.includeByFilePath) === null || _b === void 0 ? void 0 : _b.split('\n').filter(Boolean);
367
380
  const excludePatterns = (_c = intConfig === null || intConfig === void 0 ? void 0 : intConfig.excludeByFilePath) === null || _c === void 0 ? void 0 : _c.split('\n').filter(Boolean);
368
381
  try {
369
- const fullTreeResult = yield integration.getIntegrationFiles(apiCredentials, intConfig);
382
+ const fullTreeResult = yield integration.getIntegrationFiles({
383
+ credentials,
384
+ settings: intConfig,
385
+ });
370
386
  const fullTree = (0, files_1.isExtendedResultType)(fullTreeResult) ? fullTreeResult.data || [] : fullTreeResult;
371
387
  const filteredFiles = (0, files_1.filterFilesByPath)(fullTree, includePatterns, excludePatterns);
372
388
  const filteredFileIds = new Set(filteredFiles.map((f) => f.id));
@@ -394,9 +410,9 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
394
410
  client: crowdinClient,
395
411
  integration,
396
412
  context,
397
- credentials: apiCredentials,
413
+ credentials,
398
414
  rootFolder,
399
- appSettings: intConfig,
415
+ settings: intConfig,
400
416
  });
401
417
  }
402
418
  catch (e) {
@@ -405,7 +421,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
405
421
  if (Object.keys(newFiles).length) {
406
422
  const newSyncSettingsFields = allIntFiles.map((file) => (Object.assign(Object.assign({}, file), { schedule: true, sync: false })));
407
423
  yield (0, storage_1.getStorage)().updateSyncSettings(JSON.stringify(newSyncSettingsFields), syncSettings.integrationId, syncSettings.crowdinId, 'schedule', syncSettings.provider);
408
- const currentFileSnapshot = yield (0, snapshot_1.getIntegrationSnapshot)(integration, apiCredentials, intConfig);
424
+ const currentFileSnapshot = yield (0, snapshot_1.getIntegrationSnapshot)(integration, credentials, intConfig);
409
425
  yield (0, storage_1.getStorage)().updateFilesSnapshot(JSON.stringify(currentFileSnapshot), syncSettings.integrationId, syncSettings.crowdinId, syncSettings.provider);
410
426
  }
411
427
  (0, logger_1.log)(`updateCrowdin task for files cron job with period [${period}] for project ${projectId} completed`);
@@ -16,3 +16,7 @@ export declare function groupFieldsByCategory(fields: FormEntity[]): {
16
16
  name: string;
17
17
  fields: FormField[];
18
18
  }[];
19
+ export declare function buildMenuItems(integration: IntegrationLogic, appName: string): {
20
+ integrationButtonMenuItems: string | null;
21
+ crowdinButtonMenuItems: string | null;
22
+ };