@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
@@ -0,0 +1,107 @@
1
+ import type { D1Database } from '@cloudflare/workers-types';
2
+ import { Storage } from '.';
3
+ import { CrowdinCredentials } from '../types';
4
+ import { IntegrationConfig, IntegrationCredentials, IntegrationFilesSnapshot, IntegrationSyncSettings, IntegrationWebhooks } from '../modules/integration/types';
5
+ import { CreateJobParams, GetActiveJobsParams, GetJobParams, GetFileTranslationCacheByLanguageParams, Job, TranslationCache, UpdateJobParams, UpdateTranslationCacheParams, GetFileTranslationCache, UnsyncedFiles, GetUnsyncedFiles, IntegrationSyncedData, GetAllJobsParams } from '../modules/integration/util/types';
6
+ import { UserErrors } from './types';
7
+ export interface D1StorageConfig {
8
+ /**
9
+ * Cloudflare D1 database binding
10
+ * This should be passed from env.DB in Workers/Pages Functions
11
+ */
12
+ database: D1Database;
13
+ }
14
+ export declare class D1Storage implements Storage {
15
+ private db;
16
+ private migrated;
17
+ tables: {
18
+ crowdin_credentials: string;
19
+ integration_credentials: string;
20
+ sync_settings: string;
21
+ app_metadata: string;
22
+ files_snapshot: string;
23
+ webhooks: string;
24
+ user_errors: string;
25
+ integration_settings: string;
26
+ job: string;
27
+ translation_file_cache: string;
28
+ unsynced_files: string;
29
+ synced_data: string;
30
+ };
31
+ constructor(config: D1StorageConfig);
32
+ ensureMigrated(): Promise<void>;
33
+ private addColumn;
34
+ private updateTables;
35
+ migrate(): Promise<void>;
36
+ saveCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
37
+ updateCrowdinCredentials(credentials: CrowdinCredentials): Promise<void>;
38
+ getCrowdinCredentials(id: string): Promise<CrowdinCredentials | undefined>;
39
+ getAllCrowdinCredentials(): Promise<CrowdinCredentials[]>;
40
+ deleteCrowdinCredentials(id: string): Promise<void>;
41
+ saveIntegrationCredentials(id: string, credentials: any, crowdinId: string): Promise<void>;
42
+ updateIntegrationCredentials(id: string, credentials: any): Promise<void>;
43
+ updateIntegrationManagers(id: string, managers: any): Promise<void>;
44
+ getIntegrationCredentials(id: string): Promise<IntegrationCredentials | undefined>;
45
+ getAllIntegrationCredentials(crowdinId: string): Promise<IntegrationCredentials[]>;
46
+ deleteIntegrationCredentials(id: string): Promise<void>;
47
+ deleteAllIntegrationCredentials(crowdinId: string): Promise<void>;
48
+ saveMetadata(id: string, metadata: any, crowdinId: string): Promise<void>;
49
+ updateMetadata(id: string, metadata: any, crowdinId: string): Promise<void>;
50
+ getMetadata(id: string): Promise<any>;
51
+ getAllMetadata(): Promise<any[]>;
52
+ deleteMetadata(id: string): Promise<void>;
53
+ getSyncSettingsByProvider(integrationId: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
54
+ getSyncSettingsBySchedule(type: string, schedule: string): Promise<IntegrationSyncSettings[]>;
55
+ saveSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
56
+ updateSyncSettings(files: any, integrationId: string, crowdinId: string, type: string, provider: string): Promise<void>;
57
+ getSyncSettings(integrationId: string, crowdinId: string, type: string, provider: string): Promise<IntegrationSyncSettings | undefined>;
58
+ saveFilesSnapshot(files: any, integrationId: string, crowdinId: string, provider: string): Promise<void>;
59
+ updateFilesSnapshot(files: any, integrationId: string, crowdinId: string, provider: string): Promise<void>;
60
+ getFilesSnapshot(integrationId: string, crowdinId: string, provider: string): Promise<IntegrationFilesSnapshot | undefined>;
61
+ getAllWebhooks(integrationId: string, crowdinId: string, provider: string): Promise<IntegrationWebhooks[] | undefined>;
62
+ getWebhooks(fileId: string, integrationId: string, crowdinId: string, provider: string): Promise<IntegrationWebhooks | undefined>;
63
+ saveWebhooks(fileId: string, integrationId: string, crowdinId: string, provider: string): Promise<void>;
64
+ deleteWebhooks(fileIds: any[], integrationId: string, crowdinId: string, provider: string): Promise<void>;
65
+ getAllUserErrors(crowdinId: string, integrationId?: string): Promise<UserErrors[] | undefined>;
66
+ saveUserError(action: string, message: string, data: any, createdAt: string, crowdinId: string, integrationId?: string): Promise<void>;
67
+ deleteUserErrors(date: string, crowdinId: string, integrationId?: string): Promise<void>;
68
+ deleteAllUsersErrorsOlderThan(date: string): Promise<void>;
69
+ saveIntegrationConfig(integrationId: string, crowdinId: string, config: any): Promise<void>;
70
+ getAllIntegrationConfigs(crowdinId: string): Promise<IntegrationConfig[]>;
71
+ getIntegrationConfig(integrationId: string): Promise<IntegrationConfig | undefined>;
72
+ updateIntegrationConfig(integrationId: string, config: any): Promise<void>;
73
+ createJob(params: CreateJobParams): Promise<string>;
74
+ updateJob(params: UpdateJobParams): Promise<void>;
75
+ getJob(params: GetJobParams): Promise<Job | undefined>;
76
+ getActiveJobs(params: GetActiveJobsParams): Promise<Job[] | undefined>;
77
+ deleteFinishedJobs(): Promise<void>;
78
+ getAllInProgressJobs(): Promise<Job[] | undefined>;
79
+ getAllJobs(params: GetAllJobsParams): Promise<Job[] | undefined>;
80
+ saveTranslationCache(params: TranslationCache): Promise<void>;
81
+ getFileTranslationCache(params: GetFileTranslationCache): Promise<TranslationCache[] | undefined>;
82
+ getFileTranslationCacheByLanguage(params: GetFileTranslationCacheByLanguageParams): Promise<TranslationCache | undefined>;
83
+ updateTranslationCache(params: UpdateTranslationCacheParams): Promise<void>;
84
+ saveUnsyncedFiles(params: UnsyncedFiles): Promise<void>;
85
+ updateUnsyncedFiles(params: UnsyncedFiles): Promise<void>;
86
+ getUnsyncedFiles(params: GetUnsyncedFiles): Promise<UnsyncedFiles | undefined>;
87
+ registerCustomTable(tableName: string, schema: Record<string, string>): Promise<void>;
88
+ insertRecord(tableName: string, data: Record<string, any>): Promise<void>;
89
+ selectRecords(tableName: string, options?: {
90
+ columns?: string[];
91
+ whereClause?: string;
92
+ orderBy?: string;
93
+ limit?: number;
94
+ offset?: number;
95
+ distinct?: boolean;
96
+ }, params?: any[]): Promise<any[]>;
97
+ updateRecord(tableName: string, data: Record<string, any>, whereClause: string, params?: any[]): Promise<void>;
98
+ deleteRecord(tableName: string, whereClause: string, params?: any[]): Promise<void>;
99
+ saveSyncedData(files: any, integrationId: string, crowdinId: string, type: string): Promise<void>;
100
+ updateSyncedData(files: any, integrationId: string, crowdinId: string, type: string): Promise<void>;
101
+ getSyncedData(integrationId: string, crowdinId: string, type: string): Promise<IntegrationSyncedData | undefined>;
102
+ /**
103
+ * Converts undefined values to null for D1 compatibility
104
+ * D1 does not support undefined values, so we convert them to null
105
+ */
106
+ private sanitizeBindValues;
107
+ }