@crowdin/app-project-module 1.9.0 → 1.11.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 (30) hide show
  1. package/out/modules/api/api.js +323 -18
  2. package/out/modules/api/components.d.ts +222 -19
  3. package/out/modules/api/components.js +222 -19
  4. package/out/modules/custom-mt/index.js +2 -1
  5. package/out/modules/file-processing/handlers/file-download.js +2 -1
  6. package/out/modules/file-processing/handlers/pre-post-process.js +2 -1
  7. package/out/modules/file-processing/handlers/translations-alignment.js +2 -1
  8. package/out/modules/file-processing/index.js +3 -2
  9. package/out/modules/file-processing/util/folder.d.ts +1 -0
  10. package/out/modules/file-processing/util/folder.js +13 -0
  11. package/out/modules/integration/handlers/crowdin-file-progress.js +5 -2
  12. package/out/modules/integration/handlers/integration-data.js +14 -2
  13. package/out/modules/integration/handlers/job-list.js +4 -1
  14. package/out/modules/integration/handlers/settings-save.js +85 -42
  15. package/out/modules/integration/handlers/settings-schema.d.ts +3 -0
  16. package/out/modules/integration/handlers/settings-schema.js +29 -0
  17. package/out/modules/integration/handlers/sync-settings-save.js +57 -3
  18. package/out/modules/integration/handlers/sync-settings.js +11 -3
  19. package/out/modules/integration/types.d.ts +7 -0
  20. package/out/modules/integration/util/files.js +19 -7
  21. package/out/modules/integration/util/job.d.ts +2 -1
  22. package/out/modules/integration/util/job.js +3 -2
  23. package/out/modules/integration/util/types.d.ts +4 -2
  24. package/out/modules/integration/util/types.js +2 -0
  25. package/out/static/ui/main.bundle.js +94 -3
  26. package/out/static/ui/main.bundle.js.map +1 -1
  27. package/out/util/index.js +3 -1
  28. package/out/util/logger.d.ts +1 -0
  29. package/out/util/logger.js +7 -0
  30. package/package.json +14 -9
@@ -26,6 +26,7 @@ const integration_login_1 = __importDefault(require("../integration/handlers/int
26
26
  const integration_update_1 = __importDefault(require("../integration/handlers/integration-update"));
27
27
  const settings_1 = __importDefault(require("../integration/handlers/settings"));
28
28
  const settings_save_1 = __importDefault(require("../integration/handlers/settings-save"));
29
+ const settings_schema_1 = __importDefault(require("../integration/handlers/settings-schema"));
29
30
  const sync_settings_1 = __importDefault(require("../integration/handlers/sync-settings"));
30
31
  const sync_settings_save_1 = __importDefault(require("../integration/handlers/sync-settings-save"));
31
32
  const types_1 = require("./types");
@@ -117,6 +118,13 @@ function getDefaultApiEndpointsManifest(config) {
117
118
  method: types_1.RequestMethods.DELETE,
118
119
  description: 'Cancel Job',
119
120
  documentationUrl: '/api-docs#tag/Jobs/operation/job.cancel',
121
+ }, {
122
+ key: 'settings-schema-api',
123
+ name: 'Get App Settings Schema',
124
+ url: '/settings/schema',
125
+ method: types_1.RequestMethods.GET,
126
+ description: 'Get settings configuration schema with field types and options',
127
+ documentationUrl: '/api-docs#tag/Settings/operation/settings.schema',
120
128
  }, {
121
129
  key: 'settings-api',
122
130
  name: 'Get App Settings',
@@ -128,18 +136,21 @@ function getDefaultApiEndpointsManifest(config) {
128
136
  name: 'Update App Settings',
129
137
  url: '/settings',
130
138
  method: types_1.RequestMethods.POST,
139
+ description: 'Update application configuration settings',
131
140
  documentationUrl: '/api-docs#tag/Settings/operation/settings.update',
132
141
  }, {
133
142
  key: 'sync-settings-api',
134
- name: 'Get Sync Settings',
143
+ name: 'Get Auto-Sync Files',
135
144
  url: '/sync-settings',
136
145
  method: types_1.RequestMethods.GET,
146
+ description: 'Get list of files configured for automatic synchronization',
137
147
  documentationUrl: '/api-docs#tag/Settings/operation/sync.settings.get',
138
148
  }, {
139
149
  key: 'sync-settings-update-api',
140
- name: 'Update Sync Settings',
150
+ name: 'Update Auto-Sync Files',
141
151
  url: '/sync-settings',
142
152
  method: types_1.RequestMethods.POST,
153
+ description: 'Configure which files should be automatically synchronized',
143
154
  documentationUrl: '/api-docs#tag/Settings/operation/sync.settings.update',
144
155
  });
145
156
  if (config.projectIntegration.loginForm) {
@@ -231,9 +242,52 @@ function addDefaultApiEndpoints(app, config) {
231
242
  * content:
232
243
  * application/json:
233
244
  * schema:
245
+ * type: object
234
246
  * properties:
235
247
  * data:
236
- * $ref: '#/components/schemas/FileProgress'
248
+ * type: object
249
+ * description: 'Translation progress data grouped by file ID'
250
+ * additionalProperties:
251
+ * type: array
252
+ * items:
253
+ * $ref: '#/components/schemas/FileProgress'
254
+ * example:
255
+ * data:
256
+ * '78866':
257
+ * - languageId: uk
258
+ * eTag: '35ddc6c8f634f062e0de95c1c159f59d'
259
+ * language:
260
+ * id: uk
261
+ * name: Ukrainian
262
+ * editorCode: uk
263
+ * twoLettersCode: uk
264
+ * threeLettersCode: ukr
265
+ * locale: uk-UA
266
+ * androidCode: uk-rUA
267
+ * osxCode: uk.lproj
268
+ * osxLocale: uk
269
+ * pluralCategoryNames: ['one', 'few', 'many', 'other']
270
+ * pluralRules: '((n%10==1 && n%100!=11) ? 0 : ...)'
271
+ * pluralExamples: ['1, 21, 31...', '2-4, 22-24...']
272
+ * textDirection: ltr
273
+ * dialectOf: null
274
+ * words:
275
+ * total: 9
276
+ * translated: 0
277
+ * preTranslateAppliedTo: 0
278
+ * approved: 0
279
+ * phrases:
280
+ * total: 3
281
+ * translated: 0
282
+ * preTranslateAppliedTo: 0
283
+ * approved: 0
284
+ * translationProgress: '0'
285
+ * approvalProgress: '0'
286
+ * qaChecksStatus:
287
+ * total: 0
288
+ * inProgress: 0
289
+ * passed: 0
290
+ * failed: 0
237
291
  */
238
292
  app.get('/file-progress', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
239
293
  config,
@@ -260,11 +314,42 @@ function addDefaultApiEndpoints(app, config) {
260
314
  * type: object
261
315
  * properties:
262
316
  * data:
263
- * $ref: '#/components/schemas/IntegrationFiles'
264
- * message:
265
- * type: string
266
- * nullable: true
267
- * description: 'Optional message (e.g., error info)'
317
+ * type: object
318
+ * properties:
319
+ * files:
320
+ * $ref: '#/components/schemas/IntegrationFiles'
321
+ * message:
322
+ * type: string
323
+ * nullable: true
324
+ * description: 'Optional message (e.g., error info)'
325
+ * stopPagination:
326
+ * type: boolean
327
+ * nullable: true
328
+ * description: 'Indicates if there are no more items to load (only for pagination)'
329
+ * example:
330
+ * data:
331
+ * files:
332
+ * - id: 'space_302374::region-eu::'
333
+ * name: 'TestSpace2808'
334
+ * path: '/TestSpace2808'
335
+ * - id: 'story_134603631080538::region-eu::'
336
+ * name: 'Test Oleksii'
337
+ * parentId: 'space_302374::region-eu::'
338
+ * path: '/TestSpace2808/Test Oleksii'
339
+ * createdAt: '2026-01-16T08:23:34.544Z'
340
+ * updatedAt: '2026-01-16T08:23:34.544Z'
341
+ * - id: 'story_302374-133936904052915::region-eu::'
342
+ * name: 'The very first after release'
343
+ * type: 'html'
344
+ * parentId: 'space_302374::region-eu::'
345
+ * path: '/TestSpace2808/The very first after release'
346
+ * createdAt: '2026-01-14T11:10:39.387Z'
347
+ * updatedAt: '2026-01-14T11:11:05.165Z'
348
+ * isNew: false
349
+ * notSynced: true
350
+ * isUpdated: false
351
+ * synced: false
352
+ * message: null
268
353
  *
269
354
  */
270
355
  app.get('/integration-files', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
@@ -488,6 +573,68 @@ function addDefaultApiEndpoints(app, config) {
488
573
  checkSubscriptionExpiration: true,
489
574
  moduleKey: 'job-cancel-api',
490
575
  }), (0, integration_credentials_1.default)({ config, integration: config.projectIntegration }), (0, job_cancel_1.default)());
576
+ /**
577
+ * @openapi
578
+ * /settings/schema:
579
+ * get:
580
+ * tags:
581
+ * - 'Settings'
582
+ * summary: 'Get Application Settings Schema'
583
+ * operationId: settings.schema
584
+ * description: 'Retrieve configuration schema with field definitions, types, options, and metadata'
585
+ * parameters:
586
+ * - $ref: '#/components/parameters/ProjectId'
587
+ * responses:
588
+ * 200:
589
+ * description: 'Settings schema with field definitions'
590
+ * content:
591
+ * application/json:
592
+ * schema:
593
+ * type: object
594
+ * properties:
595
+ * data:
596
+ * $ref: '#/components/schemas/SettingsSchemaResponse'
597
+ * example:
598
+ * data:
599
+ * - key: 'skipIntegrationNodesToggle'
600
+ * label: 'Skip Integration Nodes'
601
+ * type: 'checkbox'
602
+ * helpText: 'Skip certain files and folders...'
603
+ * category: 'general'
604
+ * position: 3
605
+ * - key: 'schedule'
606
+ * label: 'Sync schedule'
607
+ * type: 'select'
608
+ * defaultValue: '0'
609
+ * category: 'sync'
610
+ * position: 0
611
+ * helpText: 'Defines how often content is synced...'
612
+ * options:
613
+ * - value: '0'
614
+ * label: 'Disabled'
615
+ * - value: '3'
616
+ * label: '3 hours'
617
+ * - value: '24'
618
+ * label: '24 hours'
619
+ * - key: 'new-crowdin-files'
620
+ * label: 'Automatically sync new translations from Crowdin'
621
+ * type: 'checkbox'
622
+ * category: 'sync'
623
+ * position: 1
624
+ * dependencySettings: '[{\"#schedule-settings\":{\"type\":\"!equal\",\"value\":[\"0\"]}}]'
625
+ * - key: 'inContext'
626
+ * label: 'Sync In-Context Pseudo Language'
627
+ * type: 'checkbox'
628
+ * category: 'advanced'
629
+ * position: 3
630
+ * helpTextHtml: '<p><strong>What is In-Context?</strong></p>...'
631
+ */
632
+ app.get('/settings/schema', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
633
+ config,
634
+ optional: false,
635
+ checkSubscriptionExpiration: true,
636
+ moduleKey: 'settings-schema-api',
637
+ }), (0, integration_credentials_1.default)({ config, integration: config.projectIntegration }), (0, settings_schema_1.default)(config.projectIntegration));
491
638
  /**
492
639
  * @openapi
493
640
  * /settings:
@@ -504,9 +651,23 @@ function addDefaultApiEndpoints(app, config) {
504
651
  * content:
505
652
  * application/json:
506
653
  * schema:
654
+ * type: object
507
655
  * properties:
508
656
  * data:
509
657
  * $ref: '#/components/schemas/SettingsResponse'
658
+ * example:
659
+ * data:
660
+ * schedule: '3'
661
+ * condition: '1'
662
+ * new-crowdin-files: true
663
+ * new-integration-files: false
664
+ * inContext: false
665
+ * importEqSuggestions: true
666
+ * autoApproveImported: false
667
+ * translateHidden: false
668
+ * includeByFilePath: '/content/**'
669
+ * excludeByFilePath: '/drafts/**'
670
+ * skipIntegrationNodesToggle: true
510
671
  */
511
672
  app.get('/settings', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
512
673
  config,
@@ -522,14 +683,49 @@ function addDefaultApiEndpoints(app, config) {
522
683
  * - 'Settings'
523
684
  * summary: 'Update Application Settings'
524
685
  * operationId: settings.update
686
+ * description: 'Update application settings. All config keys are validated against the schema from GET /settings/schema'
525
687
  * requestBody:
526
688
  * content:
527
689
  * application/json:
528
690
  * schema:
529
691
  * $ref: '#/components/schemas/UpdateSettingsData'
530
692
  * responses:
531
- * 204:
532
- * description: 'Application Settings was successfully update'
693
+ * 202:
694
+ * description: 'Settings save job started successfully'
695
+ * content:
696
+ * application/json:
697
+ * schema:
698
+ * type: object
699
+ * properties:
700
+ * data:
701
+ * type: object
702
+ * properties:
703
+ * jobId:
704
+ * type: string
705
+ * description: 'Job identifier to track operation progress. Use GET /job-info to check status.'
706
+ * example: '067da473-fc0b-43e3-b0a2-09d26af130c1'
707
+ * 400:
708
+ * description: 'Bad Request - validation error'
709
+ * content:
710
+ * application/json:
711
+ * schema:
712
+ * $ref: '#/components/schemas/ErrorResponse'
713
+ * examples:
714
+ * missingConfig:
715
+ * summary: 'Missing config parameter'
716
+ * value:
717
+ * error:
718
+ * message: 'Missing required parameter: config'
719
+ * invalidType:
720
+ * summary: 'Config is not an object'
721
+ * value:
722
+ * error:
723
+ * message: 'Parameter "config" must be an object'
724
+ * invalidKeys:
725
+ * summary: 'Unknown config keys'
726
+ * value:
727
+ * error:
728
+ * message: 'Invalid configuration keys: unknownKey. Use GET /settings/schema to see available fields.'
533
729
  */
534
730
  app.post('/settings', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
535
731
  config,
@@ -543,14 +739,15 @@ function addDefaultApiEndpoints(app, config) {
543
739
  * get:
544
740
  * tags:
545
741
  * - 'Settings'
546
- * summary: 'Get Sync Settings'
742
+ * summary: 'Get Auto-Sync Files'
547
743
  * operationId: sync.settings.get
744
+ * description: 'Retrieve list of files configured for automatic synchronization based on schedule'
548
745
  * parameters:
549
746
  * - $ref: '#/components/parameters/ProjectId'
550
747
  * - name: provider
551
748
  * in: query
552
749
  * required: true
553
- * description: 'Data source: "crowdin" for Crowdin file-language pairs, "integration" for integration files with sync schedule'
750
+ * description: 'Sync direction: "crowdin" returns Crowdin files with target languages, "integration" returns integration files with schedule settings'
554
751
  * schema:
555
752
  * type: string
556
753
  * enum:
@@ -558,15 +755,66 @@ function addDefaultApiEndpoints(app, config) {
558
755
  * - integration
559
756
  * responses:
560
757
  * 200:
561
- * description: 'Application Sync Settings'
758
+ * description: 'List of files configured for auto-sync'
562
759
  * content:
563
760
  * application/json:
564
761
  * schema:
762
+ * type: object
565
763
  * properties:
566
764
  * data:
567
765
  * oneOf:
568
- * - { $ref: '#/components/schemas/CrowdinSyncSettingsResponse' }
569
- * - { $ref: '#/components/schemas/IntegrationSyncSettingsResponse' }
766
+ * - $ref: '#/components/schemas/CrowdinSyncSettingsResponse'
767
+ * - $ref: '#/components/schemas/IntegrationSyncSettingsResponse'
768
+ * examples:
769
+ * crowdinProvider:
770
+ * summary: 'Crowdin files auto-sync (provider=crowdin)'
771
+ * value:
772
+ * data:
773
+ * '102': ['uk', 'de', 'fr']
774
+ * '999': ['uk', 'es']
775
+ * integrationProvider:
776
+ * summary: 'Integration files auto-sync (provider=integration)'
777
+ * value:
778
+ * data:
779
+ * - id: 'story_302374-541001856::region-eu::'
780
+ * name: 'Home'
781
+ * parent_id: 'space_302374::region-eu::'
782
+ * type: 'html'
783
+ * node_type: '1'
784
+ * schedule: true
785
+ * sync: false
786
+ * isNew: false
787
+ * isUpdated: false
788
+ * notSynced: false
789
+ * synced: false
790
+ * - id: 'story_314675-584362389::region-eu::'
791
+ * name: 'Test Story'
792
+ * parent_id: 'story_584358589::region-eu::'
793
+ * type: 'html'
794
+ * node_type: '1'
795
+ * schedule: true
796
+ * sync: false
797
+ * isNew: false
798
+ * isUpdated: false
799
+ * notSynced: false
800
+ * synced: true
801
+ * 400:
802
+ * description: 'Bad Request'
803
+ * content:
804
+ * application/json:
805
+ * schema:
806
+ * $ref: '#/components/schemas/ErrorResponse'
807
+ * examples:
808
+ * missingProvider:
809
+ * summary: 'Missing provider parameter'
810
+ * value:
811
+ * error:
812
+ * message: 'Missing required parameter: provider'
813
+ * invalidProvider:
814
+ * summary: 'Invalid provider value'
815
+ * value:
816
+ * error:
817
+ * message: 'Invalid provider. Must be one of: crowdin, integration'
570
818
  */
571
819
  app.get('/sync-settings', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
572
820
  config,
@@ -580,16 +828,73 @@ function addDefaultApiEndpoints(app, config) {
580
828
  * post:
581
829
  * tags:
582
830
  * - 'Settings'
583
- * summary: 'Update Sync Settings'
831
+ * summary: 'Update Auto-Sync Files'
584
832
  * operationId: sync.settings.update
833
+ * description: 'Configure which files should be automatically synchronized based on schedule. Returns a job ID to track the operation progress.'
585
834
  * requestBody:
586
835
  * content:
587
836
  * application/json:
588
837
  * schema:
589
838
  * $ref: '#/components/schemas/UpdateSyncSettingsData'
839
+ * examples:
840
+ * crowdinFiles:
841
+ * summary: 'Configure Crowdin files for auto-sync'
842
+ * value:
843
+ * projectId: 12
844
+ * provider: 'crowdin'
845
+ * files:
846
+ * '102': ['uk', 'de']
847
+ * '999': ['uk', 'fr', 'es']
848
+ * integrationFiles:
849
+ * summary: 'Configure integration files for auto-sync'
850
+ * value:
851
+ * projectId: 12
852
+ * provider: 'integration'
853
+ * files:
854
+ * - id: 'story_302374-541001856'
855
+ * name: 'Home'
856
+ * type: 'html'
857
+ * node_type: '1'
858
+ * parent_id: 'space_302374'
859
+ * schedule: true
860
+ * sync: false
590
861
  * responses:
591
- * 204:
592
- * description: 'Application Sync Settings was successfully update'
862
+ * 200:
863
+ * description: 'Auto-sync configuration job started successfully'
864
+ * content:
865
+ * application/json:
866
+ * schema:
867
+ * type: object
868
+ * properties:
869
+ * data:
870
+ * type: object
871
+ * properties:
872
+ * jobId:
873
+ * type: string
874
+ * description: 'Job identifier to track operation progress. Use GET /job-info to check status.'
875
+ * example: '067da473-fc0b-43e3-b0a2-09d26af130c1'
876
+ * 400:
877
+ * description: 'Bad Request - validation error'
878
+ * content:
879
+ * application/json:
880
+ * schema:
881
+ * $ref: '#/components/schemas/ErrorResponse'
882
+ * examples:
883
+ * missingFiles:
884
+ * summary: 'Missing files parameter'
885
+ * value:
886
+ * error:
887
+ * message: 'Missing required parameter: files'
888
+ * missingProvider:
889
+ * summary: 'Missing provider parameter'
890
+ * value:
891
+ * error:
892
+ * message: 'Missing required parameter: provider'
893
+ * invalidProvider:
894
+ * summary: 'Invalid provider value'
895
+ * value:
896
+ * error:
897
+ * message: 'Invalid provider. Must be one of: crowdin, integration'
593
898
  */
594
899
  app.post('/sync-settings', api_call_1.default, json_response_1.default, (0, crowdin_client_1.default)({
595
900
  config,