@crowdin/app-project-module 0.107.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.
- package/out/app-test/integration/get-integration-files.js +16 -4
- package/out/app-test/integration/types.d.ts +1 -1
- package/out/app-test/integration/update-crowdin.js +2 -2
- package/out/app-test/integration/update-integration.js +2 -2
- package/out/index.d.ts +2 -1
- package/out/index.js +73 -30
- package/out/middlewares/auto-credentials-masker.d.ts +4 -0
- package/out/middlewares/auto-credentials-masker.js +45 -0
- package/out/middlewares/crowdin-client.d.ts +1 -1
- package/out/middlewares/integration-credentials.d.ts +2 -2
- package/out/middlewares/integration-credentials.js +7 -4
- package/out/middlewares/render-ui-module.d.ts +3 -3
- package/out/middlewares/render-ui-module.js +10 -13
- package/out/middlewares/ui-module.d.ts +1 -1
- package/out/middlewares/ui-module.js +11 -1
- package/out/modules/about.d.ts +2 -1
- package/out/modules/about.js +10 -3
- package/out/modules/ai-prompt-provider/handlers/compile.d.ts +1 -1
- package/out/modules/ai-prompt-provider/handlers/compile.js +7 -1
- package/out/modules/ai-prompt-provider/index.js +2 -2
- package/out/modules/ai-prompt-provider/types.d.ts +7 -1
- package/out/modules/ai-provider/handlers/chat-completions.d.ts +1 -1
- package/out/modules/ai-provider/handlers/chat-completions.js +1 -1
- package/out/modules/ai-provider/handlers/get-model-list.d.ts +1 -1
- package/out/modules/ai-provider/index.js +2 -2
- package/out/modules/ai-provider/types.d.ts +4 -4
- package/out/modules/ai-request-processors/handler.d.ts +1 -1
- package/out/modules/ai-request-processors/handler.js +12 -2
- package/out/modules/ai-request-processors/types.d.ts +12 -2
- package/out/modules/ai-tools/handlers/tool-calls.d.ts +1 -1
- package/out/modules/ai-tools/handlers/tool-calls.js +1 -1
- package/out/modules/ai-tools/index.js +1 -1
- package/out/modules/ai-tools/types.d.ts +1 -1
- package/out/modules/api/api.js +58 -7
- package/out/modules/api/base.d.ts +1 -0
- package/out/modules/api/base.js +1 -0
- package/out/modules/api/components.d.ts +251 -27
- package/out/modules/api/components.js +251 -27
- package/out/modules/auth-guard/handlers/verify.d.ts +1 -1
- package/out/modules/auth-guard/index.js +1 -1
- package/out/modules/automation-action/handlers/execute.d.ts +1 -1
- package/out/modules/automation-action/handlers/execute.js +1 -1
- package/out/modules/automation-action/handlers/input-schema.d.ts +1 -1
- package/out/modules/automation-action/handlers/output-schema.d.ts +1 -1
- package/out/modules/automation-action/handlers/validate-settings.d.ts +1 -1
- package/out/modules/automation-action/handlers/validate-settings.js +1 -1
- package/out/modules/automation-action/index.js +1 -1
- package/out/modules/automation-action/types.d.ts +4 -4
- package/out/modules/automation-action/util/index.js +2 -5
- package/out/modules/context-menu/index.js +2 -2
- package/out/modules/custom-mt/handlers/translate.d.ts +1 -1
- package/out/modules/custom-mt/handlers/translate.js +25 -9
- package/out/modules/custom-mt/index.js +3 -3
- package/out/modules/custom-mt/types.d.ts +10 -2
- package/out/modules/custom-spell-check/handlers/get-languages-list.d.ts +1 -1
- package/out/modules/custom-spell-check/handlers/spell-check.d.ts +1 -1
- package/out/modules/custom-spell-check/index.js +4 -4
- package/out/modules/editor-right-panel/index.js +1 -1
- package/out/modules/external-qa-check/handlers/validate.d.ts +1 -1
- package/out/modules/external-qa-check/index.js +2 -2
- package/out/modules/file-processing/handlers/custom-file-format.d.ts +7 -2
- package/out/modules/file-processing/handlers/custom-file-format.js +62 -22
- package/out/modules/file-processing/handlers/file-download.d.ts +1 -1
- package/out/modules/file-processing/handlers/file-download.js +5 -0
- package/out/modules/file-processing/handlers/pre-post-process.d.ts +1 -1
- package/out/modules/file-processing/handlers/pre-post-process.js +41 -15
- package/out/modules/file-processing/handlers/translations-alignment.d.ts +1 -1
- package/out/modules/file-processing/handlers/translations-alignment.js +10 -4
- package/out/modules/file-processing/index.js +12 -2
- package/out/modules/file-processing/types.d.ts +36 -5
- package/out/modules/file-processing/util/defaults.js +50 -6
- package/out/modules/file-processing/util/files.js +2 -1
- package/out/modules/form-data-display.d.ts +1 -1
- package/out/modules/form-data-save.d.ts +1 -1
- package/out/modules/install.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-file-progress.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-file-progress.js +5 -1
- package/out/modules/integration/handlers/crowdin-files-target-languages.d.ts +5 -0
- package/out/modules/integration/handlers/crowdin-files-target-languages.js +103 -0
- package/out/modules/integration/handlers/crowdin-files.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-files.js +7 -1
- package/out/modules/integration/handlers/crowdin-project.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-update.js +59 -18
- package/out/modules/integration/handlers/crowdin-webhook.d.ts +1 -1
- package/out/modules/integration/handlers/crowdin-webhook.js +15 -8
- package/out/modules/integration/handlers/integration-data.d.ts +1 -1
- package/out/modules/integration/handlers/integration-data.js +13 -6
- package/out/modules/integration/handlers/integration-login.d.ts +1 -1
- package/out/modules/integration/handlers/integration-logout.d.ts +1 -1
- package/out/modules/integration/handlers/integration-logout.js +8 -3
- package/out/modules/integration/handlers/integration-update.d.ts +1 -1
- package/out/modules/integration/handlers/integration-update.js +44 -6
- package/out/modules/integration/handlers/integration-webhook.d.ts +1 -1
- package/out/modules/integration/handlers/invite-users.d.ts +1 -1
- package/out/modules/integration/handlers/job-cancel.d.ts +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.d.ts +1 -1
- package/out/modules/integration/handlers/job-info-deprecated.js +3 -2
- package/out/modules/integration/handlers/job-info.d.ts +1 -1
- package/out/modules/integration/handlers/job-list.d.ts +1 -1
- package/out/modules/integration/handlers/main.d.ts +1 -1
- package/out/modules/integration/handlers/main.js +32 -2
- package/out/modules/integration/handlers/oauth-login.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-login.js +28 -6
- package/out/modules/integration/handlers/oauth-polling.d.ts +1 -1
- package/out/modules/integration/handlers/oauth-url.d.ts +1 -1
- package/out/modules/integration/handlers/settings-save.d.ts +1 -1
- package/out/modules/integration/handlers/settings-save.js +9 -9
- package/out/modules/integration/handlers/settings.d.ts +1 -1
- package/out/modules/integration/handlers/sync-settings-save.d.ts +1 -1
- package/out/modules/integration/handlers/sync-settings-save.js +5 -9
- package/out/modules/integration/handlers/sync-settings.d.ts +1 -1
- package/out/modules/integration/handlers/user-errors.d.ts +1 -1
- package/out/modules/integration/handlers/users.d.ts +1 -1
- package/out/modules/integration/index.js +19 -33
- package/out/modules/integration/types.d.ts +133 -29
- package/out/modules/integration/types.js +1 -0
- package/out/modules/integration/util/cron.d.ts +2 -2
- package/out/modules/integration/util/cron.js +40 -24
- package/out/modules/integration/util/defaults.d.ts +4 -0
- package/out/modules/integration/util/defaults.js +175 -15
- package/out/modules/integration/util/files.d.ts +2 -1
- package/out/modules/integration/util/files.js +19 -8
- package/out/modules/integration/util/job.js +4 -3
- package/out/modules/integration/util/snapshot.js +19 -3
- package/out/modules/integration/util/types.d.ts +1 -0
- package/out/modules/integration/util/types.js +1 -0
- package/out/modules/integration/util/webhooks.d.ts +8 -8
- package/out/modules/integration/util/webhooks.js +34 -17
- package/out/modules/manifest.js +12 -12
- package/out/modules/modal/index.js +2 -2
- package/out/modules/organization-menu/index.js +5 -4
- package/out/modules/organization-settings-menu/index.js +5 -4
- package/out/modules/profile-resources-menu/index.js +5 -4
- package/out/modules/profile-settings-menu/index.js +5 -4
- package/out/modules/project-menu/index.js +1 -1
- package/out/modules/project-menu-crowdsource/index.js +1 -1
- package/out/modules/project-reports/index.js +3 -2
- package/out/modules/project-tools/index.js +3 -2
- package/out/modules/status.d.ts +1 -1
- package/out/modules/status.js +12 -3
- package/out/modules/subscription-paid.d.ts +1 -1
- package/out/modules/uninstall.d.ts +1 -1
- package/out/modules/uninstall.js +1 -1
- package/out/modules/webhooks/handlers/webhook-handler.d.ts +2 -2
- package/out/modules/webhooks/handlers/webhook-handler.js +33 -22
- package/out/modules/webhooks/types.d.ts +7 -0
- package/out/modules/workflow-step-type/handlers/delete-step.d.ts +1 -1
- package/out/modules/workflow-step-type/handlers/step-settings-save.d.ts +1 -1
- package/out/modules/workflow-step-type/index.js +2 -2
- package/out/modules/workflow-step-type/types.d.ts +1 -1
- package/out/modules/workflow-step-type/util/index.js +3 -6
- package/out/static/js/dependent.js +16 -7
- package/out/static/ui/error.bundle.js +474 -0
- package/out/static/ui/error.bundle.js.map +1 -0
- package/out/static/ui/install.bundle.js +459 -0
- package/out/static/ui/install.bundle.js.map +1 -0
- package/out/static/ui/login.bundle.js +630 -0
- package/out/static/ui/login.bundle.js.map +1 -0
- package/out/static/ui/main.bundle.js +2109 -0
- package/out/static/ui/main.bundle.js.map +1 -0
- package/out/static/ui/oauth.bundle.js +467 -0
- package/out/static/ui/oauth.bundle.js.map +1 -0
- package/out/storage/d1.d.ts +107 -0
- package/out/storage/d1.js +831 -0
- package/out/storage/index.js +8 -1
- package/out/storage/mysql.js +22 -19
- package/out/storage/postgre.d.ts +0 -1
- package/out/storage/postgre.js +20 -30
- package/out/storage/sqlite.d.ts +2 -5
- package/out/storage/sqlite.js +29 -69
- package/out/types.d.ts +80 -18
- package/out/util/connection.js +16 -5
- package/out/util/credentials-masker.d.ts +3 -3
- package/out/util/credentials-masker.js +14 -20
- package/out/util/cron.d.ts +29 -0
- package/out/util/cron.js +87 -0
- package/out/util/index.d.ts +14 -1
- package/out/util/index.js +121 -10
- package/out/util/jsx-renderer.d.ts +14 -0
- package/out/util/jsx-renderer.js +35 -0
- package/out/util/logger.d.ts +1 -0
- package/out/util/logger.js +2 -2
- package/out/util/static-files.d.ts +19 -0
- package/out/util/static-files.js +87 -0
- package/out/util/subscription.js +1 -1
- package/out/views/AboutPage.d.ts +10 -0
- package/out/views/AboutPage.js +76 -0
- package/out/views/FormPage.d.ts +14 -0
- package/out/views/FormPage.js +28 -0
- package/out/views/SubscriptionPage.d.ts +7 -0
- package/out/views/SubscriptionPage.js +26 -0
- package/out/views/index.d.ts +8 -0
- package/out/views/index.js +15 -0
- package/out/views/layout/Head.d.ts +9 -0
- package/out/views/layout/Head.js +54 -0
- package/package.json +43 -41
- package/out/util/handlebars.d.ts +0 -1
- package/out/util/handlebars.js +0 -46
- package/out/views/about.handlebars +0 -102
- package/out/views/error.handlebars +0 -54
- package/out/views/form.handlebars +0 -31
- package/out/views/install.handlebars +0 -16
- package/out/views/login.handlebars +0 -332
- package/out/views/main.handlebars +0 -2042
- package/out/views/oauth.handlebars +0 -11
- package/out/views/partials/head.handlebars +0 -53
- package/out/views/subscription.handlebars +0 -26
|
@@ -5,50 +5,100 @@
|
|
|
5
5
|
* schemas:
|
|
6
6
|
* CrowdinFiles:
|
|
7
7
|
* type: array
|
|
8
|
-
*
|
|
8
|
+
* description: 'List of Crowdin files and folders'
|
|
9
|
+
* example: [{id: '1', name: 'Landing pages'}, {id: '2', parentId: '1', name: 'Home Page', type: 'json'}]
|
|
9
10
|
* items:
|
|
10
11
|
* anyOf:
|
|
11
|
-
* -
|
|
12
|
+
* - type: object
|
|
13
|
+
* description: 'Folder'
|
|
14
|
+
* properties:
|
|
12
15
|
* id:
|
|
13
16
|
* type: string
|
|
17
|
+
* description: 'Unique identifier'
|
|
14
18
|
* name:
|
|
15
19
|
* type: string
|
|
16
|
-
*
|
|
20
|
+
* description: 'Folder name'
|
|
21
|
+
* parentId:
|
|
22
|
+
* type: string
|
|
23
|
+
* description: 'Parent folder identifier'
|
|
24
|
+
* - type: object
|
|
25
|
+
* description: 'File'
|
|
26
|
+
* properties:
|
|
17
27
|
* id:
|
|
18
28
|
* type: string
|
|
29
|
+
* description: 'Unique identifier'
|
|
19
30
|
* parentId:
|
|
20
31
|
* type: string
|
|
32
|
+
* description: 'Parent folder identifier'
|
|
21
33
|
* name:
|
|
22
34
|
* type: string
|
|
35
|
+
* description: 'File name'
|
|
23
36
|
* type:
|
|
24
37
|
* type: string
|
|
38
|
+
* description: 'File type (e.g., json, xml, html)'
|
|
39
|
+
* excludedTargetLanguages:
|
|
40
|
+
* type: array
|
|
41
|
+
* description: 'Languages excluded from translation'
|
|
42
|
+
* items:
|
|
43
|
+
* type: string
|
|
44
|
+
* NodeType:
|
|
45
|
+
* type: string
|
|
46
|
+
* description: 'Type of tree element'
|
|
47
|
+
* enum:
|
|
48
|
+
* - '0'
|
|
49
|
+
* - '1'
|
|
50
|
+
* - '2'
|
|
51
|
+
* x-enum-descriptions:
|
|
52
|
+
* - 'Folder'
|
|
53
|
+
* - 'File'
|
|
54
|
+
* - 'Branch'
|
|
25
55
|
* IntegrationFiles:
|
|
26
56
|
* type: array
|
|
27
|
-
*
|
|
57
|
+
* description: 'List of integration files and folders'
|
|
58
|
+
* example: [{id: '1', name: 'Landing pages'}, {id: '73291251883', name: 'Intro', parentId: '1', type: 'json'}]
|
|
28
59
|
* items:
|
|
29
60
|
* anyOf:
|
|
30
|
-
* -
|
|
61
|
+
* - type: object
|
|
62
|
+
* description: 'Folder'
|
|
63
|
+
* properties:
|
|
31
64
|
* id:
|
|
32
65
|
* type: string
|
|
66
|
+
* description: 'Unique identifier'
|
|
33
67
|
* name:
|
|
34
68
|
* type: string
|
|
35
|
-
*
|
|
69
|
+
* description: 'Folder name'
|
|
70
|
+
* parentId:
|
|
36
71
|
* type: string
|
|
37
|
-
*
|
|
72
|
+
* description: 'Parent folder identifier'
|
|
73
|
+
* - type: object
|
|
74
|
+
* description: 'File'
|
|
75
|
+
* properties:
|
|
76
|
+
* id:
|
|
38
77
|
* type: string
|
|
39
|
-
*
|
|
78
|
+
* description: 'Unique identifier'
|
|
40
79
|
* name:
|
|
41
80
|
* type: string
|
|
42
|
-
*
|
|
43
|
-
* type: string
|
|
81
|
+
* description: 'File name'
|
|
44
82
|
* parentId:
|
|
45
83
|
* type: string
|
|
84
|
+
* description: 'Parent folder identifier'
|
|
46
85
|
* type:
|
|
47
86
|
* type: string
|
|
48
|
-
*
|
|
49
|
-
*
|
|
87
|
+
* description: 'File type (e.g., json, xml, html)'
|
|
88
|
+
* isNew:
|
|
89
|
+
* type: boolean
|
|
90
|
+
* description: 'Whether file is new (not synced before)'
|
|
91
|
+
* isUpdated:
|
|
92
|
+
* type: boolean
|
|
93
|
+
* description: 'Whether file was updated since last sync'
|
|
94
|
+
* notSynced:
|
|
95
|
+
* type: boolean
|
|
96
|
+
* description: 'Whether file was never synced'
|
|
97
|
+
* synced:
|
|
98
|
+
* type: boolean
|
|
99
|
+
* description: 'Whether file is synced'
|
|
50
100
|
* UpdateCrowdinFiles:
|
|
51
|
-
* title: '
|
|
101
|
+
* title: 'Sync Files to Crowdin'
|
|
52
102
|
* required:
|
|
53
103
|
* - projectId
|
|
54
104
|
* - files
|
|
@@ -65,7 +115,7 @@
|
|
|
65
115
|
* default: false
|
|
66
116
|
* example: true
|
|
67
117
|
* FileLanguagePair:
|
|
68
|
-
* title: '
|
|
118
|
+
* title: 'Sync Translations to Integration'
|
|
69
119
|
* required:
|
|
70
120
|
* - projectId
|
|
71
121
|
* - files
|
|
@@ -135,7 +185,7 @@
|
|
|
135
185
|
* type:
|
|
136
186
|
* type: string
|
|
137
187
|
* node_type:
|
|
138
|
-
*
|
|
188
|
+
* $ref: '#/components/schemas/NodeType'
|
|
139
189
|
* schedule:
|
|
140
190
|
* type: boolean
|
|
141
191
|
* UpdateSyncSettingsData:
|
|
@@ -200,17 +250,45 @@
|
|
|
200
250
|
* type: integer
|
|
201
251
|
* example: 86
|
|
202
252
|
* LoginFieldsResponse:
|
|
203
|
-
* type:
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* type:
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
253
|
+
* type: object
|
|
254
|
+
* properties:
|
|
255
|
+
* fields:
|
|
256
|
+
* type: array
|
|
257
|
+
* items:
|
|
258
|
+
* type: object
|
|
259
|
+
* properties:
|
|
260
|
+
* key:
|
|
261
|
+
* type: string
|
|
262
|
+
* description: 'Unique field identifier'
|
|
263
|
+
* example: 'apiKey'
|
|
264
|
+
* name:
|
|
265
|
+
* type: string
|
|
266
|
+
* description: 'Human-readable field label'
|
|
267
|
+
* example: 'Service API key'
|
|
268
|
+
* type:
|
|
269
|
+
* type: string
|
|
270
|
+
* description: 'Field input type'
|
|
271
|
+
* enum:
|
|
272
|
+
* - text
|
|
273
|
+
* - password
|
|
274
|
+
* - checkbox
|
|
275
|
+
* - select
|
|
276
|
+
* - textarea
|
|
277
|
+
* - file
|
|
278
|
+
* - notice
|
|
279
|
+
* example: 'password'
|
|
280
|
+
* options:
|
|
281
|
+
* type: array
|
|
282
|
+
* description: 'Available options (only for select type)'
|
|
283
|
+
* items:
|
|
284
|
+
* type: object
|
|
285
|
+
* properties:
|
|
286
|
+
* label:
|
|
287
|
+
* type: string
|
|
288
|
+
* value:
|
|
289
|
+
* type: string
|
|
290
|
+
* example:
|
|
291
|
+
* fields: [{ key: 'email', name: 'User email', type: 'text' }, { key: 'password', name: 'User password', type: 'password' }]
|
|
214
292
|
* Login:
|
|
215
293
|
* title: 'Login'
|
|
216
294
|
* required:
|
|
@@ -227,8 +305,146 @@
|
|
|
227
305
|
* type: object
|
|
228
306
|
* description: 'Login Form Fields. Get via [Integration Login Form Fields](#operation/integration.fields)'
|
|
229
307
|
* example: { email: 'user@crowdin.com', password: 'password' }
|
|
308
|
+
* JobStatus:
|
|
309
|
+
* type: string
|
|
310
|
+
* description: 'Possible job statuses'
|
|
311
|
+
* enum:
|
|
312
|
+
* - created
|
|
313
|
+
* - inProgress
|
|
314
|
+
* - finished
|
|
315
|
+
* - failed
|
|
316
|
+
* - canceled
|
|
317
|
+
* JobType:
|
|
318
|
+
* type: string
|
|
319
|
+
* description: 'Possible job types'
|
|
320
|
+
* enum:
|
|
321
|
+
* - updateCrowdin
|
|
322
|
+
* - updateIntegration
|
|
323
|
+
* - crowdinSyncSettingsSave
|
|
324
|
+
* - integrationSyncSettingsSave
|
|
325
|
+
* JobListItem:
|
|
326
|
+
* type: object
|
|
327
|
+
* description: 'Job item returned in list response'
|
|
328
|
+
* properties:
|
|
329
|
+
* id:
|
|
330
|
+
* type: string
|
|
331
|
+
* description: 'Unique identifier of the job'
|
|
332
|
+
* example: '067da473-fc0b-43e3-b0a2-09d26af130c1'
|
|
333
|
+
* progress:
|
|
334
|
+
* type: integer
|
|
335
|
+
* description: 'Current progress percentage (0-100)'
|
|
336
|
+
* minimum: 0
|
|
337
|
+
* maximum: 100
|
|
338
|
+
* example: 94
|
|
339
|
+
* status:
|
|
340
|
+
* $ref: '#/components/schemas/JobStatus'
|
|
341
|
+
* title:
|
|
342
|
+
* type: string
|
|
343
|
+
* description: 'Human-readable title of the job'
|
|
344
|
+
* example: 'Sync files to Crowdin'
|
|
345
|
+
* type:
|
|
346
|
+
* $ref: '#/components/schemas/JobType'
|
|
347
|
+
* createdAt:
|
|
348
|
+
* type: string
|
|
349
|
+
* format: date-time
|
|
350
|
+
* description: 'ISO 8601 timestamp when the job was created'
|
|
351
|
+
* example: '2024-01-15T10:30:00.000Z'
|
|
352
|
+
* finishedAt:
|
|
353
|
+
* type: string
|
|
354
|
+
* format: date-time
|
|
355
|
+
* nullable: true
|
|
356
|
+
* description: 'ISO 8601 timestamp when the job finished (null if not finished)'
|
|
357
|
+
* example: '2024-01-15T10:35:00.000Z'
|
|
230
358
|
* Job:
|
|
231
359
|
* type: object
|
|
360
|
+
* description: 'Detailed job information'
|
|
361
|
+
* properties:
|
|
362
|
+
* id:
|
|
363
|
+
* type: string
|
|
364
|
+
* description: 'Unique identifier of the job'
|
|
365
|
+
* example: '067da473-fc0b-43e3-b0a2-09d26af130c1'
|
|
366
|
+
* progress:
|
|
367
|
+
* type: integer
|
|
368
|
+
* description: 'Current progress percentage (0-100)'
|
|
369
|
+
* minimum: 0
|
|
370
|
+
* maximum: 100
|
|
371
|
+
* example: 94
|
|
372
|
+
* status:
|
|
373
|
+
* $ref: '#/components/schemas/JobStatus'
|
|
374
|
+
* title:
|
|
375
|
+
* type: string
|
|
376
|
+
* description: 'Human-readable title of the job'
|
|
377
|
+
* example: 'Sync files to Crowdin'
|
|
378
|
+
* type:
|
|
379
|
+
* $ref: '#/components/schemas/JobType'
|
|
380
|
+
* info:
|
|
381
|
+
* type: string
|
|
382
|
+
* nullable: true
|
|
383
|
+
* description: 'Additional information about the job progress (e.g., ETA)'
|
|
384
|
+
* example: 'About 2 minutes remaining'
|
|
385
|
+
* data:
|
|
386
|
+
* type: object
|
|
387
|
+
* nullable: true
|
|
388
|
+
* description: 'Additional data associated with the job'
|
|
389
|
+
* payload:
|
|
390
|
+
* type: object
|
|
391
|
+
* nullable: true
|
|
392
|
+
* description: 'Original payload used to create the job'
|
|
393
|
+
* attempt:
|
|
394
|
+
* type: integer
|
|
395
|
+
* nullable: true
|
|
396
|
+
* description: 'Current attempt number for retried jobs'
|
|
397
|
+
* example: 1
|
|
398
|
+
* eta:
|
|
399
|
+
* type: number
|
|
400
|
+
* nullable: true
|
|
401
|
+
* description: 'Estimated time remaining in milliseconds'
|
|
402
|
+
* example: 120000
|
|
403
|
+
* createdAt:
|
|
404
|
+
* type: string
|
|
405
|
+
* format: date-time
|
|
406
|
+
* description: 'ISO 8601 timestamp when the job was created'
|
|
407
|
+
* example: '2024-01-15T10:30:00.000Z'
|
|
408
|
+
* updatedAt:
|
|
409
|
+
* type: string
|
|
410
|
+
* format: date-time
|
|
411
|
+
* nullable: true
|
|
412
|
+
* description: 'ISO 8601 timestamp when the job was last updated'
|
|
413
|
+
* example: '2024-01-15T10:32:00.000Z'
|
|
414
|
+
* finishedAt:
|
|
415
|
+
* type: string
|
|
416
|
+
* format: date-time
|
|
417
|
+
* nullable: true
|
|
418
|
+
* description: 'ISO 8601 timestamp when the job finished'
|
|
419
|
+
* example: '2024-01-15T10:35:00.000Z'
|
|
420
|
+
* JobListResponse:
|
|
421
|
+
* type: object
|
|
422
|
+
* description: 'List of jobs response'
|
|
423
|
+
* properties:
|
|
424
|
+
* data:
|
|
425
|
+
* type: array
|
|
426
|
+
* items:
|
|
427
|
+
* $ref: '#/components/schemas/JobListItem'
|
|
428
|
+
* JobInfoResponse:
|
|
429
|
+
* type: object
|
|
430
|
+
* description: 'Single job info response'
|
|
431
|
+
* properties:
|
|
432
|
+
* data:
|
|
433
|
+
* $ref: '#/components/schemas/Job'
|
|
434
|
+
* ErrorResponse:
|
|
435
|
+
* type: object
|
|
436
|
+
* properties:
|
|
437
|
+
* error:
|
|
438
|
+
* type: object
|
|
439
|
+
* properties:
|
|
440
|
+
* message:
|
|
441
|
+
* type: string
|
|
442
|
+
* description: 'Error message describing what went wrong'
|
|
443
|
+
* example: 'jobId is required'
|
|
444
|
+
* JobBasic:
|
|
445
|
+
* type: object
|
|
446
|
+
* deprecated: true
|
|
447
|
+
* description: 'Basic job info (deprecated format)'
|
|
232
448
|
* properties:
|
|
233
449
|
* id:
|
|
234
450
|
* type: string
|
|
@@ -248,11 +464,13 @@
|
|
|
248
464
|
* example: 'Sync files to Crowdin'
|
|
249
465
|
* JobResponse:
|
|
250
466
|
* type: object
|
|
467
|
+
* deprecated: true
|
|
468
|
+
* description: 'Deprecated. Use Job or JobListResponse instead'
|
|
251
469
|
* properties:
|
|
252
470
|
* data:
|
|
253
471
|
* type: array
|
|
254
472
|
* items:
|
|
255
|
-
* $ref: '#/components/schemas/
|
|
473
|
+
* $ref: '#/components/schemas/JobBasic'
|
|
256
474
|
*
|
|
257
475
|
* parameters:
|
|
258
476
|
* ProjectId:
|
|
@@ -263,4 +481,10 @@
|
|
|
263
481
|
* schema:
|
|
264
482
|
* type: integer
|
|
265
483
|
* example: 12
|
|
484
|
+
*
|
|
485
|
+
* securitySchemes:
|
|
486
|
+
* bearerAuth:
|
|
487
|
+
* type: http
|
|
488
|
+
* scheme: bearer
|
|
489
|
+
* description: 'Crowdin API Personal Access Token. Get via [Account Settings](https://crowdin.com/settings#api-key)'
|
|
266
490
|
*/
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { AuthGuardModule } from '../types';
|
|
5
|
-
export default function verifyHandler(authGuardModules: AuthGuardModule[]): (req:
|
|
5
|
+
export default function verifyHandler(authGuardModules: AuthGuardModule[]): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -22,7 +22,7 @@ function register({ config, app }) {
|
|
|
22
22
|
authGuardModules.forEach((module, index) => {
|
|
23
23
|
if (module.settingsUiModule) {
|
|
24
24
|
const moduleKey = module.key || `${config.identifier}-auth-guard-${index}`;
|
|
25
|
-
app.use(`/auth-guard/${moduleKey}/settings`, (0, ui_module_1.default)({ config, moduleType: moduleKey }), (0, render_ui_module_1.default)(module.settingsUiModule));
|
|
25
|
+
app.use(`/auth-guard/${moduleKey}/settings`, (0, ui_module_1.default)({ config, moduleType: moduleKey }), (0, render_ui_module_1.default)(module.settingsUiModule, config));
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
// Register verification endpoint
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { AutomationActionModule } from '../types';
|
|
5
|
-
export default function getExecuteHandler(automationAction: AutomationActionModule): (req:
|
|
5
|
+
export default function getExecuteHandler(automationAction: AutomationActionModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { AutomationActionModule } from '../types';
|
|
4
4
|
import { CrowdinClientRequest } from '../../../types';
|
|
5
|
-
export default function getInputSchemaHandler(automationAction: AutomationActionModule): (req:
|
|
5
|
+
export default function getInputSchemaHandler(automationAction: AutomationActionModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { AutomationActionModule } from '../types';
|
|
4
4
|
import { CrowdinClientRequest } from '../../../types';
|
|
5
|
-
export default function getOutputSchemaHandler(automationAction: AutomationActionModule): (req:
|
|
5
|
+
export default function getOutputSchemaHandler(automationAction: AutomationActionModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { AutomationActionModule } from '../types';
|
|
4
4
|
import { CrowdinClientRequest } from '../../../types';
|
|
5
|
-
export default function getInputSchemaHandler(automationAction: AutomationActionModule): (req:
|
|
5
|
+
export default function getInputSchemaHandler(automationAction: AutomationActionModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -21,7 +21,7 @@ function getInputSchemaHandler(automationAction) {
|
|
|
21
21
|
client: req.crowdinApiClient,
|
|
22
22
|
settings: ((_a = req === null || req === void 0 ? void 0 : req.body) === null || _a === void 0 ? void 0 : _a.settings) || [],
|
|
23
23
|
context: req.crowdinContext,
|
|
24
|
-
|
|
24
|
+
request: req.body,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
res.json({ data: result });
|
|
@@ -38,7 +38,7 @@ function register({ config, app }) {
|
|
|
38
38
|
moduleKey: automationAction.key,
|
|
39
39
|
}), (0, execute_1.default)(automationAction));
|
|
40
40
|
if (automationAction.settingsUiModule) {
|
|
41
|
-
app.use((0, util_1.getAutomationActionUrl)('/automation-action', automationAction), (0, ui_module_1.default)({ config, moduleType: automationAction.key }), (0, render_ui_module_1.default)(automationAction.settingsUiModule));
|
|
41
|
+
app.use((0, util_1.getAutomationActionUrl)('/automation-action', automationAction), (0, ui_module_1.default)({ config, moduleType: automationAction.key }), (0, render_ui_module_1.default)(automationAction.settingsUiModule, config));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -21,21 +21,21 @@ export interface AutomationActionModule extends ModuleKey, ImagePath {
|
|
|
21
21
|
* JSON schema defining the structure of input parameters expected by the automation action
|
|
22
22
|
*/
|
|
23
23
|
inputSchema?: any;
|
|
24
|
-
validateSettings?: ({ client, settings, context,
|
|
24
|
+
validateSettings?: ({ client, settings, context, request, }: {
|
|
25
25
|
client: Crowdin;
|
|
26
26
|
settings: any;
|
|
27
27
|
context: CrowdinContextInfo;
|
|
28
|
-
|
|
28
|
+
request: any;
|
|
29
29
|
}) => Promise<any>;
|
|
30
30
|
/**
|
|
31
31
|
* function to execute the automation action
|
|
32
32
|
*/
|
|
33
|
-
execute: ({ client, inputData, validationErrors, context,
|
|
33
|
+
execute: ({ client, inputData, validationErrors, context, request, }: {
|
|
34
34
|
client: Crowdin;
|
|
35
35
|
inputData: any;
|
|
36
36
|
validationErrors?: Record<string, string> | undefined;
|
|
37
37
|
context: CrowdinContextInfo;
|
|
38
|
-
|
|
38
|
+
request: any;
|
|
39
39
|
}) => Promise<any>;
|
|
40
40
|
/**
|
|
41
41
|
* Settings UI module
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getAutomationActionUrl = exports.getAutomationActionKey = void 0;
|
|
7
|
-
const
|
|
4
|
+
const util_1 = require("../../../util");
|
|
8
5
|
function getAutomationActionKey(automationAction) {
|
|
9
|
-
return (0,
|
|
6
|
+
return (0, util_1.kebabCase)(automationAction.name);
|
|
10
7
|
}
|
|
11
8
|
exports.getAutomationActionKey = getAutomationActionKey;
|
|
12
9
|
function getAutomationActionUrl(path, automationAction) {
|
|
@@ -16,14 +16,14 @@ function register({ config, app }) {
|
|
|
16
16
|
if (Array.isArray(config.contextMenu)) {
|
|
17
17
|
config.contextMenu.forEach((contextMenu) => {
|
|
18
18
|
if ((contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.uiPath) || (contextMenu === null || contextMenu === void 0 ? void 0 : contextMenu.formSchema)) {
|
|
19
|
-
app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu));
|
|
19
|
+
app.use(`/context-${contextMenu.key}`, (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: contextMenu.key }), (0, render_ui_module_1.default)(contextMenu, config));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
// backward compatibility will be removed after migration
|
|
25
25
|
if (((_a = config.contextMenu) === null || _a === void 0 ? void 0 : _a.uiPath) || ((_b = config.contextMenu) === null || _b === void 0 ? void 0 : _b.formSchema)) {
|
|
26
|
-
app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu));
|
|
26
|
+
app.use('/context', (0, ui_module_1.default)({ config, allowUnauthorized, moduleType: config.contextMenu.key }), (0, render_ui_module_1.default)(config.contextMenu, config));
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { CustomMTHandleOptions } from '../types';
|
|
5
|
-
export default function handle({ baseUrl, folder, config }: CustomMTHandleOptions): (req:
|
|
5
|
+
export default function handle({ baseUrl, folder, config, fileStore }: CustomMTHandleOptions): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -17,10 +17,13 @@ const path_1 = __importDefault(require("path"));
|
|
|
17
17
|
const util_1 = require("../../../util");
|
|
18
18
|
const logger_1 = require("../../../util/logger");
|
|
19
19
|
const files_1 = require("../../file-processing/util/files");
|
|
20
|
-
function handle({ baseUrl, folder, config }) {
|
|
21
|
-
|
|
22
|
-
if (!
|
|
23
|
-
|
|
20
|
+
function handle({ baseUrl, folder, config, fileStore }) {
|
|
21
|
+
let dataFolder = '';
|
|
22
|
+
if (!fileStore) {
|
|
23
|
+
dataFolder = path_1.default.join(folder, 'custom-mt');
|
|
24
|
+
if (!fs_1.default.existsSync(dataFolder)) {
|
|
25
|
+
fs_1.default.mkdirSync(dataFolder, { recursive: true });
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
const baseFilesUrl = `${baseUrl}/file/download/custom-mt`;
|
|
26
29
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -50,7 +53,14 @@ function handle({ baseUrl, folder, config }) {
|
|
|
50
53
|
res.send({ data: { translations: [] } });
|
|
51
54
|
return;
|
|
52
55
|
}
|
|
53
|
-
const translations = yield config.translate(
|
|
56
|
+
const translations = yield config.translate({
|
|
57
|
+
client: req.crowdinApiClient,
|
|
58
|
+
context: req.crowdinContext,
|
|
59
|
+
projectId,
|
|
60
|
+
source,
|
|
61
|
+
target,
|
|
62
|
+
strings,
|
|
63
|
+
});
|
|
54
64
|
if (!Array.isArray(translations)) {
|
|
55
65
|
res.send({ data: { translations } });
|
|
56
66
|
return;
|
|
@@ -62,12 +72,18 @@ function handle({ baseUrl, folder, config }) {
|
|
|
62
72
|
}
|
|
63
73
|
else {
|
|
64
74
|
let url;
|
|
65
|
-
if (
|
|
66
|
-
|
|
75
|
+
if (fileStore) {
|
|
76
|
+
const fileRef = yield fileStore.storeFile(bufferData);
|
|
77
|
+
url = `${baseFilesUrl}?file=${fileRef}`;
|
|
67
78
|
}
|
|
68
79
|
else {
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
if (config.storeFile) {
|
|
81
|
+
url = yield config.storeFile(bufferData);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const storedFile = yield (0, files_1.storeFile)(bufferData, dataFolder);
|
|
85
|
+
url = `${baseFilesUrl}?file=${storedFile}`;
|
|
86
|
+
}
|
|
71
87
|
}
|
|
72
88
|
res.send({ data: { translationsUrl: url } });
|
|
73
89
|
}
|
|
@@ -13,20 +13,20 @@ function register({ config, app }) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
const folder = config.customMT.filesFolder || config.dbFolder;
|
|
16
|
-
app.
|
|
16
|
+
app.use('/logo/mt', (0, util_1.serveLogo)(config, config.customMT));
|
|
17
17
|
app.post('/mt/translate', (0, crowdin_client_1.default)({
|
|
18
18
|
config,
|
|
19
19
|
optional: false,
|
|
20
20
|
checkSubscriptionExpiration: true,
|
|
21
21
|
moduleKey: config.customMT.key,
|
|
22
|
-
}), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: config.customMT }));
|
|
22
|
+
}), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: config.customMT, fileStore: config.fileStore }));
|
|
23
23
|
app.get('/file/download/custom-mt', (0, file_download_1.default)(config, config.customMT, 'custom-mt'));
|
|
24
24
|
// TEMPORARY CODE: it needs to support old path
|
|
25
25
|
app.post('/translate', (0, crowdin_client_1.default)({
|
|
26
26
|
config,
|
|
27
27
|
optional: false,
|
|
28
28
|
checkSubscriptionExpiration: true,
|
|
29
|
-
}), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: config.customMT }));
|
|
29
|
+
}), (0, translate_1.default)({ baseUrl: config.baseUrl, folder, config: config.customMT, fileStore: config.fileStore }));
|
|
30
30
|
// END TEMPORARY CODE
|
|
31
31
|
}
|
|
32
32
|
exports.register = register;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import Crowdin, { SourceStringsModel } from '@crowdin/crowdin-api-client';
|
|
4
|
-
import { CrowdinContextInfo, ModuleKey } from '../../types';
|
|
4
|
+
import { CrowdinContextInfo, FileStore, ModuleKey } from '../../types';
|
|
5
5
|
export interface CustomMTLogic extends ModuleKey {
|
|
6
6
|
withContext?: boolean;
|
|
7
7
|
splitStringsIntoChunks?: boolean;
|
|
8
8
|
batchSize?: number;
|
|
9
9
|
maskEntities?: boolean;
|
|
10
10
|
filesFolder?: string;
|
|
11
|
-
translate: (
|
|
11
|
+
translate: (options: {
|
|
12
|
+
client: Crowdin;
|
|
13
|
+
context: CrowdinContextInfo;
|
|
14
|
+
projectId: number | null;
|
|
15
|
+
source: string;
|
|
16
|
+
target: string;
|
|
17
|
+
strings: CustomMtString[];
|
|
18
|
+
}) => Promise<string[]>;
|
|
12
19
|
validate?: (client: Crowdin) => Promise<void>;
|
|
13
20
|
storeFile?: (fileContent: Buffer) => Promise<string>;
|
|
14
21
|
}
|
|
@@ -20,6 +27,7 @@ export interface CustomMTHandleOptions {
|
|
|
20
27
|
baseUrl: string;
|
|
21
28
|
folder: string;
|
|
22
29
|
config: CustomMTLogic;
|
|
30
|
+
fileStore?: FileStore;
|
|
23
31
|
}
|
|
24
32
|
export type CustomMtString = string | {
|
|
25
33
|
id: number;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { CustomSpellcheckerModule } from '../types';
|
|
5
|
-
export default function handle(customSpellchecker: CustomSpellcheckerModule): (req:
|
|
5
|
+
export default function handle(customSpellchecker: CustomSpellcheckerModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
import { Response } from 'express';
|
|
3
3
|
import { CrowdinClientRequest } from '../../../types';
|
|
4
4
|
import { CustomSpellcheckerModule } from '../types';
|
|
5
|
-
export default function handle(customSpellchecker: CustomSpellcheckerModule): (req:
|
|
5
|
+
export default function handle(customSpellchecker: CustomSpellcheckerModule): (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> | CrowdinClientRequest, res: Response<any, Record<string, any>>, next: Function) => void;
|